Iphone 如何允许UITapGestureRecognitor检测web视图上的点击?
我已经在Xcode中为iPhone制作了web浏览器,要退出web浏览器并返回主页,您可以在屏幕上点击三次,但该手势只在屏幕顶部和底部的工具栏上起作用,而不会在web视图上起作用 我能做什么 这是我的密码 .h文件 Implement should recognize与GestureRecognizer委托同时识别,并返回YES 实施详情: 将UIgestureRecognitizerDelegate协议添加到.h文件中Iphone 如何允许UITapGestureRecognitor检测web视图上的点击?,iphone,xcode,uiwebview,gestures,Iphone,Xcode,Uiwebview,Gestures,我已经在Xcode中为iPhone制作了web浏览器,要退出web浏览器并返回主页,您可以在屏幕上点击三次,但该手势只在屏幕顶部和底部的工具栏上起作用,而不会在web视图上起作用 我能做什么 这是我的密码 .h文件 Implement should recognize与GestureRecognizer委托同时识别,并返回YES 实施详情: 将UIgestureRecognitizerDelegate协议添加到.h文件中 @interface ViewController : UIViewCon
@interface ViewController : UIViewController <UIGestureRecognizerDelegate>
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
NSString *homePageString = @"http://www.google.com";
NSURL *homePage = [NSURL URLWithString:homePageString];
NSURLRequest *requestHomePage = [NSURLRequest requestWithURL:homePage];
[webview loadRequest:requestHomePage];
forwards.enabled = NO;
backwards.enabled = NO;
UIAlertView *touchHelp = [[UIAlertView alloc] initWithTitle:@"Alert, Please Read" message:@"To go back to the App Selection Page please anywhere on the top or bottom toolbar three times" delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil, nil];
[touchHelp show];
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapDetected:)];
tapRecognizer.numberOfTapsRequired = 3;
[self.view addGestureRecognizer:tapRecognizer];
}
- (void)tapDetected:(UITapGestureRecognizer *)tapRecognizer {
[self dismissViewControllerAnimated:YES completion:nil];
}
@interface ViewController : UIViewController <UIGestureRecognizerDelegate>
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES
}