我使用以下代码:
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
self.location = [touch locationInView:self.view];
NSLog(@"%@", NSStringFromCGPoint(location));
}
为了尝试找到用户可能触摸屏幕的位置,我认为[触摸任何对象]
将允许它检测用户触摸屏幕的位置,即使另一个对象已被触摸已选择。然而,当我选择一个按钮时,情况似乎并非如此。有人可以帮我吗?
谢谢!
最佳答案
UIButtons 默认情况下“吸收”触摸,因此您必须手动传递它。
查看此线程以获取更多信息: Is there a way to pass touches through on the iPhone?
关于iphone - TouchsAnyObject 没有像我想象的那样工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7394253/