我有一个iPad项目与UISplitViewController结构:顶部检测透明的UIView倒是
- RootViewController的
- DetailviewController
他们两人都是检测自己的类内手势识别器接触。
我想在所有类之上创建一个透明的UIView,以检测只有一个对角滑动(从左下角到右上角)。
因此,当滑动将被检测到时,我将启动一个函数,否则没有附加任何东西,触摸应该在低级视图上传递。
我尝试这两种解决方案:
- 添加GestureRecognizer这个顶部透明的看法,但这样会隐藏所有接触到较低层次视图(启用用户交互:是ofcourse)。
另一个解决办法是让初始化这样
-(id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
[self setBackgroundColor:[UIColor colorWithWhite:1 alpha:0.01]];
[self setUserInteractionEnabled:NO];
}
return self;
}
,并尝试与
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
检测刷卡,但在这一点上的所有接触都没有检测到。
任何人都有一个很好的解决方案?
Tnx为快速回答。 –
Tnx @tiguero快速回答。你是对的,但不是所有的IOS版本都支持手势识别器。我发现的是,正确的方法应该是**继承UIWindow并覆盖“ - (void)sendEvent:(UIEvent *)事件'和 - (BOOL)pointInside:(CGPoint)point withEvent: (UIEvent *)事件'。所以我可以调用/或不调用'[super sendEvent:event]'将事件传递给UIViews Hierarchy。你认为这个解决方案的家伙是什么? –