我有一个
你能给我一些提示吗?我在这个部分遇到了问题!
以下是我的代码:
UIViewController
,里面有三个UIWebView
。我已经通过编程的方式为我的webViews添加了左滑功能。现在我可以左滑浏览3页,然后重复。我想增加当前页数并将其添加到我的webView3中,但是我不知道该如何操作。你能给我一些提示吗?我在这个部分遇到了问题!
以下是我的代码:
- (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是一个整数,在开始时它的值为0。我的问题是,我应该如何将我的currentPage添加到webView3中,以便当我滑动它时增加我的页面?
- (void)swipeLeftAction:(id)ignored
{
NSLog(@"Swipe Left");
UIWebView *temp = webView2 ;
webView2 = webView3;
webView3 = webView;
webView = temp;
[webView2 bringToFront];
currentPage++;
}
提前感谢你!
****编辑:**
这个页面当前没有连接到任何webView,我该如何在我的webView中实现此增加?**