在 iPhone 中查找动画时子视图何时被触摸?
我向视图添加了一个子视图。我在触摸时找到它,当它动画触摸事件时找到子视图。 这是代码...
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
if ([touch self]) {
NSLog(@"View Touched");
}
if ([[touch view] isKindOfClass:[Baloon class]]) {
NSLog(@"Baloon Touched");
}
}
I added a subview to the view. I am finding it when touched, when it is animating touch event is finding the subview..
Here is the code...
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
if ([touch self]) {
NSLog(@"View Touched");
}
if ([[touch view] isKindOfClass:[Baloon class]]) {
NSLog(@"Baloon Touched");
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该在气球类中实现“touchesBegan”方法,并在“touchesMove”方法中将新位置设置为气球!
you should implement the "touchesBegan" Method in your Baloon Class and in the "touchesMove" Method set the new Position to the Baloon!