vIEwDIDLoad(){ // relevant code starbutton = UIbutton(type: UIbuttonType.Custom) starbutton.frame = CGRectMake(100,100,50,50) starbutton.setimage(UIImage(named: "yellowstar.png"),forState: UIControlState.normal) sceneVIEw.addSubvIEw(starbutton) starbutton.addTarget(self,action: "starbuttonClicked",forControlEvents: UIControlEvents.touchUpInsIDe) starbutton.adjustsImageWhenHighlighted = false } func starbuttonClicked(){ animateScaleDown() } func animateScaleDown(){ UIVIEw.animateWithDuration(0.1,animations: { self.starbutton.transform = CGAffinetransformMakeScale(0.8,0.8) },completion: { _ in self.wait() }) } func wait(){ UIVIEw.animateWithDuration(0.2,animations: {},completion: { _ in UIVIEw.animateWithDuration(0.2,animations: { self.starbutton.transform = CGAffinetransformMakeScale(1,1) }) }) }解决方法 好的,我解决了.有问题的代码是
starbutton.addTarget(self,forControlEvents: UIControlEvents.touchUpInsIDe)
UIControlEvent.touchUpInsIDe给出了滞后的错觉.将它更改为.touchDown要好得多.
总结以上是内存溢出为你收集整理的ios – 为sceneKit视图添加了按钮,但它有一个滞后全部内容,希望文章能够帮你解决ios – 为sceneKit视图添加了按钮,但它有一个滞后所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)