I am trying to get a gesture to reload a webpage for an app I am coding for. As of now the gestures are working by using UIGestureRecognizer
. I have successfully been able to code such that when I swipe I have a UILabel
change. I want to use this gesture to reload a webpage. Currently, I have something like this in my m file that causes this to happen.
- (void)ScreenWasSwiped
{
[swipe setText:@"This is working"];
}
and under viewdidload
UISwipeGestureRecognizer *swipedown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector (ScreenWasSwiped)];
swipedown.numberOfTouchesRequired = 1;
swipedown.direction=UISwipeGestureRecognizerDirectionDown;
[self.view addGestureRecognizer:swipedown];
How can I change this so that I can reload the browser with the same gesture?
Thanks in advance.
In your method called ScreenWasSwiped
, use call reload
on your UIWebView instance. It'll look something like this:
-(void)ScreenWasSwiped
{
[myWebView reload];
}