动画期间UIButton不交互
|
我正在尝试为UIButton设置动画。但是在动画过程中,没有与UIButton交互。预期的行为是在移动按钮时可以单击它。这是UIButton和动画的代码片段:
UIImage *cloudImage = [UIImage imageNamed:@\"sprite.png\"];
UIButton moveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[moveBtn setFrame:CGRectMake(0.0, 80.0, cloudImage.size.width, cloudImage.size.height)];
[moveBtn setImage:cloudImage forState:UIControlStateNormal];
[moveBtn addTarget:self action:@selector(hit:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:moveBtn];
CGPoint newLeftCenter = CGPointMake( 300.0f + moveBtn.frame.size.width / 2.0f, moveBtn.center.y);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:5.0f];
[UIView setAnimationRepeatCount:HUGE_VALF];
moveBtn.center = newLeftCenter;
[UIView commitAnimations];
hit
选择器仅显示NSLog以显示按钮是否响应。任何帮助,将不胜感激。
没有找到相关结果
已邀请:
5 个回复
癸痊醒
嘘崇蔡对
。
捕暑句簿姓
莽缓逢
旗低饶彤