iPad兼容。 UIBarButtonItem有一个UIToolbarTextButton类型的未记录视图。咦? [英] iPad. UIBarButtonItem has an undocumented view of type UIToolbarTextButton. Huh?
问题描述
我有一个iPad应用程序,我有一个视图控制器,它是许多UIGestureRecognizers的UIGestureRecognizerDelegate。我已经实现了以下UIGestureRecognizerDelegate方法:
I have an iPad app where I have a view controller that is the UIGestureRecognizerDelegate for a number of UIGestureRecognizers. I have implemented the following method of UIGestureRecognizerDelegate:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
// Double tapping anywhere on the screen hides/shows the toolbar
if ([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]] == YES) {
if (touch.tapCount == 2) {
self.toolbar.hidden = self.toolbar.isHidden ? NO : YES;
} // if (touch.tapCount == 2)
} // if ([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]] == YES)
// All gestures are ignored unless they happen on the fullscreen EAGLView
if ([touch.view isKindOfClass:[EAGLView class]] == NO) {
return NO;
} // if ([touch.view isKindOfClass:[EAGLView class]] == NO)
return YES;
}
我的设置是全屏在EAGLView上面有一个UIToolbar的EAGLView。工具栏上有一个UIBarButtonItem。这里的想法是双击任何地方切换工具栏的外观。所有其他手势必须出现在EAGLView上。
My setup is a fullscreen EAGLView with a UIToolbar atop the EAGLView. There is a UIBarButtonItem on the toolbar. The idea here is that double-tapping anywhere toggles the appearance of the toolbar. All other gestures must occur on the EAGLView.
我的问题是直接点击UIBarButtonItem显示touch.view是UIView子类UIToolbarTextButton,它是未记录的,无法进行内省。
My problem is that taps directly on the UIBarButtonItem show touch.view to be the UIView subclass UIToolbarTextButton which is undocumented and can't be introspected.
嗯?
有人可以建议一个解决方案,最好是使用某种形式的内省善吗?
Can someone suggest a work around, preferably that uses introspective goodness of some form?
谢谢,
Doug
Thanks,
Doug
谢谢,
Doug
推荐答案
您可以计算 .superview
重复直到你到达UIToolbar,EAGLView或 nil
。
You can compute the .superview
repeatedly until you reach a UIToolbar, EAGLView or nil
.
这篇关于iPad兼容。 UIBarButtonItem有一个UIToolbarTextButton类型的未记录视图。咦?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!