【发布时间】:2013-01-21 09:52:28
【问题描述】:
我正在探索在 iOS 设备上处理触摸事件的方式。我参考了这本书:iOS Open Application Development。为此,我重写了 mouseDown、mouseUp 方法并简单地在警告框中显示坐标。然而,被覆盖的方法永远不会被调用。下面是从 UIView 派生的 newView 类的代码:
-(void) _mouseDown: (GSEventRef) event{
CGPoint point =GSEventGetLocationInWindow(event);
UIAlertView* alert;
NSString* alertString =[NSString stringWithFormat: @"%f %f", point.x, point.y];
alert = [[UIALertView alloc] initWithTitle:@"Success" message:alertString delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
}
-(BOOL) canHandleGestures{
return YES;
}
有没有我遗漏的部分?另外,是否有其他方法可以获取有关触摸事件的信息并进行处理?
【问题讨论】:
标签: iphone ios ios4 gesture-recognition iphone-privateapi