Page enlargement after each scroll of Objective-C

I have one UIViewController and inside it I have 3 UIWebView . I added programmatically. Right now I can swipe, but only 3 pages, and then repeat. I want to enlarge my current page and add it to my webView3, but I do not know how to do this.

Could you give me some advice? I really have a problem in this part!

Here is my code:

 - (void)viewDidLoad { [super viewDidLoad]; NSLog(@"test view"); NSURL *url = [NSURL fileURLWithPath:[ [ NSBundle mainBundle ] pathForResource: @"Name/Name1" ofType:@"html" ]]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [webView2 loadRequest:request]; [webView2 bringToFront]; NSURL *url = [NSURL fileURLWithPath:[ [ NSBundle mainBundle ] pathForResource: @"Name/Name2" ofType:@"html" ]]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [webView3 loadRequest:request]; UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeLeftAction:)]; swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft; swipeLeft.delegate = self; [self.view addGestureRecognizer:swipeLeft]; } - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { return YES; } 

currentPage is an integer and at the beginning it is 0. My question is, how should I add my current page to webView3 so that when I skip it will enlarge my pages?

  - (void)swipeLeftAction:(id)ignored { NSLog(@"Swipe Left"); UIWebView *temp = webView2 ; webView2 = webView3; webView3 = webView; webView = temp; [webView2 bringToFront]; currentPage++; } 

Thanks in advance!

**** Edit: **

This current page is not associated with any webView, how can I get this increase in my web browser? **

+7
source share
1 answer

Based on the information from this message ( Does UIGestureRecognizer work on UIWebView? ), It looks like gesture recognizers, and web views do not always work well, the reason is that they have their own gesture recognition widgets. Perhaps the best way would be to add links inside your web browser so that when you touch, use your own scheme to increase currentPage

 -(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType { if ( [[[inRequest URL] absoluteString] hasPrefix:@"mySchemeIncrementPage:"] ) { currentPage++; NSLog(@"CURRENT PAGE COUNT: %i", currentPage); return NO; } } 
0
source

All Articles