Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes, easily you can subclass <code>UIWebView</code>, and implement</p> <pre><code>- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event </code></pre> <p>in this way:</p> <p>// ViewController.h</p> <pre><code>@interface APWebView : UIWebView @end @interface APViewController : UIViewController &lt;UIGestureRecognizerDelegate&gt; { IBOutlet APWebView *_webview; } @end </code></pre> <p>// ViewController.m</p> <pre><code>@implementation APWebView - (id)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; UISwipeGestureRecognizer *SwipeRecognizerLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(SwipeDetected:)]; SwipeRecognizerLeft.direction = UISwipeGestureRecognizerDirectionLeft; [self addGestureRecognizer:SwipeRecognizerLeft]; UISwipeGestureRecognizer *SwipeRecognizerRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(SwipeDetected:)]; SwipeRecognizerRight.direction = UISwipeGestureRecognizerDirectionRight; [self addGestureRecognizer:SwipeRecognizerRight]; return self; } - (void) SwipeDetected:(UISwipeGestureRecognizer*)gesture { if ( gesture.direction == UISwipeGestureRecognizerDirectionLeft ) NSLog(@"LEFT"); else NSLog(@"RIGHT"); } - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { return YES; } @end @implementation APViewController - (void)viewDidLoad { [super viewDidLoad]; [ _webview loadRequest: [NSURLRequest requestWithURL: [NSURL URLWithString: @"http://www.google.it"]] ]; } @end </code></pre> <p>Add on your Xib (or storyboard) the UIWebView and assign the subclass:</p> <p><img src="https://i.stack.imgur.com/WodOV.png" alt="enter image description here"></p> <p>In your console log you should see:</p> <pre><code>2013-10-16 09:51:33.861 SwipeLR[14936:a0b] LEFT 2013-10-16 09:51:34.377 SwipeLR[14936:a0b] RIGHT 2013-10-16 09:51:35.009 SwipeLR[14936:a0b] LEFT [...] </code></pre> <p>Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload