我创建了简单的单一视图应用程序,只添加了一个按钮即可查看。 接下来,我使用下一个代码来确定所有子视图及其手势识别器:
-(void) debug:(UIView*) view{
for(UIGestureRecognizer* g in view.gestureRecognizers)
{
NSLog(@"base view gr=%@ gr_view=%@",NSStringFromClass ([g class]),g.view);
}
for (UIView* sub in view.subviews) {
NSLog(@"%@.subview=%@",NSStringFromClass ([view class]),NSStringFromClass ([sub class]));
for(UIGestureRecognizer* g in sub.gestureRecognizers)
{
NSLog(@" | gr=%@ gr_view=%@",NSStringFromClass ([g class]),g.view);
}
[self debug:sub];
}
}
但是日志在现有视图中显示NO ONE手势识别器及其子视图。我希望能够访问默认的应用程序手势识别器,我该怎么做?