iPad 模拟器无法接收 iPhone 320x480 帧之外的触摸事件
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
gestureStartPoint = [touch locationInView:self.view];
NSLog(@"test x:%f",gestureStartPoint.x);
NSLog(@"test y:%f",gestureStartPoint.y);
etc..
奇怪的是,如果我在 320x480 框架之外单击(从左上角开始),我不会收到任何日志语句。在 TouchesBegan 的其他地方,我调用了传入触摸的其他方法,但这些方法没有响应,因此将这些 NSLog 放入。
我需要做什么才能从完整的 1024x768 视图接收触摸事件?
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
gestureStartPoint = [touch locationInView:self.view];
NSLog(@"test x:%f",gestureStartPoint.x);
NSLog(@"test y:%f",gestureStartPoint.y);
etc..
Srangely, I'm not receiving any log statements if I click outside a 320x480 frame (starting from upper-left corner). Elsewhere in touchesBegan I call other methods passing in the touch and these weren't responding, so put these NSLogs in.
What do I have to do to receive touch events from the full 1024x768 view?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的 UIView 实际上是窗口的完整尺寸吗?
Is your UIView actually the full size of the window?
我认为“升级 iPad 的当前目标”任务中存在错误。
我通过创建一个以 iPad 作为产品的新“Window XIB”,然后用新 XIB 中的 Window 对象替换 MainWindow-iPad.xib 中的 Window 对象来解决此问题。 (请务必更新应用程序委托的“窗口”出口。)
I think there's a bug in the "Upgrade Current Target for iPad" task.
I fixed this issue by creating a new "Window XIB" with iPad as the product, then replacing the Window object in MainWindow-iPad.xib with the Window object in the new XIB. (Be sure to update the "window" outlet of your app delegate.)