UIWebView不在UITabBarController中滚动

时间:2012-07-13 13:39:57

标签: iphone ios ipad

我设置了4个视图控制器,每个视图控制器都包含UIWebView,并将其设置为UITabBarController的标签。

内容加载正常,按钮可点击,但UIWebViews的内容拒绝滚动。 UIWebView有一个内置UIScrollView来处理它自己的滚动,所以它应该向右滚动?

我在主文件中的初始化代码是:

tabBarController = [[MainTabBarController alloc] init];
[tabBarController.view setBounds:CGRectMake(0, 0, dev_portrait.size.width, 44)];
[tabBarController setDelegate:self];

UIImage* anImage = [UIImage imageNamed:@"53-house.png"];
UITabBarItem* theItem = [[UITabBarItem alloc] initWithTitle:@"Home" image:anImage tag:0];
WebViewController *vc1 = [[WebViewController alloc] initWithNibName:@"WebController" bundle:nil];
[vc1 setup];
[vc1 setTabBarItem:theItem];

/// ... same for the other 3 WebViewControllers

NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, vc3, vc4, aNavigationController, nil];
tabBarController.viewControllers = controllers;
//self.window.rootViewController = tabBarController;
self.window.rootViewController = tabBarController;

触摸选项卡时,它会在视图控制器中触发一个加载URL的函数:

- (void)handleURL:(NSString *)url {
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
    NSLog(@"Handling URL: %@", request);
    [webpage loadRequest:request];
    lastURL = url;
    [self startLoaderIndicator];
}

0 个答案:

没有答案