UITapGestureRecognizer不适用于旧版本的ios

时间:2017-04-26 04:46:04

标签: ios objective-c uitapgesturerecognizer

我正在处理一个视图,该视图的子视图是outlet是viewRect。我以编程方式在该视图上添加了UITapGestureRecognizer来执行任务。 它适用于ios 10.3.1(iPhone 5),但不适用于iOS 9.2.1(iPhone 5)。

UITapGestureRecognizer *mTapGestureRecognizer = [[UITapGestureRecognizer  alloc]initWithTarget:self action:@selector(showView)];
[mTapGestureRecognizer setNumberOfTouchesRequired:1];
[self.viewRect addGestureRecognizer:mTapGestureRecognizer];
self.viewRect.userInteractionEnabled = YES;

回应方法

-(void)showView {

NSLog("tapped on view");

}

无法弄清楚为什么这不起作用。

0 个答案:

没有答案