Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何允许UITapGestureRecognitor检测web视图上的点击?_Iphone_Xcode_Uiwebview_Gestures - Fatal编程技术网

Iphone 如何允许UITapGestureRecognitor检测web视图上的点击?

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

我已经在Xcode中为iPhone制作了web浏览器,要退出web浏览器并返回主页,您可以在屏幕上点击三次,但该手势只在屏幕顶部和底部的工具栏上起作用,而不会在web视图上起作用

我能做什么

这是我的密码

.h文件

Implement should recognize与GestureRecognizer委托同时识别,并返回YES

实施详情:

将UIgestureRecognitizerDelegate协议添加到.h文件中

@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
 }