【发布时间】:2013-02-07 07:40:25
【问题描述】:
我已经阅读了几个关于移动 UIButton 的主题,并且可以在移动时触摸按钮。现在我正在使用 UIView beginAnimation,但按钮在移动时无法触摸。
我也读过一些关于 NSTimer 的文章,但这不是我项目中最好的方法。
还有其他方法,有人遇到同样的问题吗?
这是我的示例代码..
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];
【问题讨论】:
标签: cocoa-touch uibutton touch