UIWebView Swipe-Gesture

use*_*380 1 xcode uiwebview uiswipegesturerecognizer swipe-gesture

一切都在我的代码中工作,但我总是警告"swipeLeft.delegate = self;"

这个警告标志着"自我".

警告是:将'UIWebView*'传递给不兼容类型的参数

将'viewCont*const __strong'传递给不兼容类型的参数"id UIGestureRecognizerDelegate

我能做什么??

我的代码:

#import "viewCont.h"

@implementation viewCont

@synthesize webView = webView_;

- (void)viewDidLoad
{
//...code

// add Left 
    UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeLeftAction:)];
    swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
    swipeLeft.delegate =  self;
    [webView_ addGestureRecognizer:swipeLeft];

//code....
}
Run Code Online (Sandbox Code Playgroud)

pal*_*lob 6

关于线:

swipeLeft.delegate =  self;
Run Code Online (Sandbox Code Playgroud)

您的控制器需要实现UIGestureRecognizerDelegate,如下所示:

@interface viewCont : UIViewController<UIGestureRecognizerDelegate> {

}

@end
Run Code Online (Sandbox Code Playgroud)

在提供的代码中,我没有看到任何有关webView警告的问题代码.