我创建了简单的单视图应用程序,并且只添加了一个按钮来查看。接下来我使用下一个代码来确定所有子视图及其手势识别器:
-(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];
}
}
但是日志在现有视图及其子视图中显示没有一个手势识别器。我想访问默认的应用程序手势识别器,我该怎么做?