Cocoa touch UI按钮移动和触摸
我已经阅读了几个有关移动UIButton的主题,并且可以在按钮移动时触摸按钮。现在我使用的是UIView beginAnimation,但按钮在移动时无法触摸 我也读过一些关于NSTimer的文章,但这不是我项目中最好的方法 有没有别的办法,有人也有同样的问题Cocoa touch UI按钮移动和触摸,cocoa-touch,uibutton,touch,Cocoa Touch,Uibutton,Touch,我已经阅读了几个有关移动UIButton的主题,并且可以在按钮移动时触摸按钮。现在我使用的是UIView beginAnimation,但按钮在移动时无法触摸 我也读过一些关于NSTimer的文章,但这不是我项目中最好的方法 有没有别的办法,有人也有同样的问题 下面是我的示例代码 UIButton *buttonTapObject = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [buttonTapObject addTarget:se
下面是我的示例代码
UIButton *buttonTapObject = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[buttonTapObject addTarget:self action:@selector(tapObjectTapped:) forControlEvents:UIControlEventTouchUpInside];
buttonTapObject.tag = 100;
buttonTapObject.frame = CGRectMake(-80.0, 40.0, 80.0, 80.0);
[UIView beginAnimations:@"example" context:NULL];
[UIView setAnimationDuration:2.0];
// Move to right
buttonTapObject.center = CGPointMake(360.0, 100.0);
[UIView commitAnimations];
在botton设置动画时,您的主线程可能被锁定,因此无法处理任何接口交互。在按钮设置动画时,您可以按其他按钮吗
如果没有,请将动画移动到背景线程。是的,我可以触摸其他不移动的按钮