如何在objective-c中访问UITapGesture中的子视图控件?
问题描述:
朋友你好,请帮我,我 添加UITapGesture上的UIWindow,但我不能在屏幕上能够访问父控件如何在objective-c中访问UITapGesture中的子视图控件?
UIRotationGestureRecognizer *rot =[[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(handleRotation:)];
rot.cancelsTouchesInView = NO;
rot.delegate = self;
UIPinchGestureRecognizer *pinch =[[UIPinchGestureRecognizer alloc] initWithTarget:self
action:@selector(handlePinch:)];
pinch.cancelsTouchesInView = NO;
pinch.delegate = self;
/* UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self
action:@selector(handlePan:)];
pan.cancelsTouchesInView = NO;
pan.delegate = self;*/
//circle gesture
gr = [[MDCircleGestureRecognizer alloc] init];
[gr addTarget:self action:@selector(handleGesture:)];
//[self.view addGestureRecognizer:gr];
//gr.delegate = (id<MDCircleGestureFailureDelegate>)self.view;
gr.delegate = self;
gr.cancelsTouchesInView = NO;
////Z gesture
cg = [[CharGesture alloc] initWithTarget:self action:@selector(zLetterMade:)];
cg.delegate=self;
cg.cancelsTouchesInView = NO;
//Add on window - RR
[[[UIApplication sharedApplication]delegate]window].gestureRecognizers = @[gr,cg,pinch,rot];
答
请确认你已经给UIGestureRecognizerDelegate
并启用互动[[[UIApplication sharedApplication]delegate]window].userInteractionEnabled=YES;
感谢您接受回答 –