简体   繁体   中英

UIWebview does not show up into UINavigationController

I have a tabBar application. In the first tab, I have a navigation bar. In this navigation bar I have a table view. When the user clicks a cell of the table, it goes to another table view, and when the user clicks a cell in that table, it goes to a webview to open a web page.

Basically, it goes fine until opening the webview. In the webview, viewDidLoad is called and seems to work properly. However, webViewDidStartLoad is never called and the web page never shows up.

I am not using IB. I build the UITabBarController in the AppDelegate, where I also assign an instance of my UINavigationController for each tab.

I call the webview from the second UITableViewController as follows:

rssWebViewController = [[webViews objectAtIndex: indexPath.row] objectForKey:@"controller"];
[[self navigationController] pushViewController:rssWebViewController animated:YES];

I have checked that the navigationController is there and it seems just fine.

The viewDidload of my webview is as follows:

- (void)viewDidLoad {
    [super viewDidLoad];
    NSString *urlAddress = self.storyUrl;
    NSURL *url = [NSURL URLWithString:urlAddress];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [[self rssWebView] setDelegate: self];
    [[self view] addSubview:[self rssWebView]];
    [rssWebView loadRequest:requestObj];
    self.rssWebView.scalesPageToFit = YES; 
    self.rssWebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
    }

The web view controller interface is defined as follows:

@interface RSSWebViewController : UIViewController <UIWebViewDelegate>{
    IBOutlet UIWebView *rssWebView;
    IBOutlet NSString *storyUrl;
    IBOutlet NSString *feedName;
}
@property (nonatomic, retain) IBOutlet UIWebView *rssWebView;
@property (nonatomic, retain) IBOutlet NSString *storyUrl;
@property (nonatomic, retain) IBOutlet NSString *feedName;
@end

Any help is greatly appreciated.

好吧,我发现了,我不得不开始我的WebView在viewDidLoad中框架:

rssWebView = [[UIWebView alloc] initWithFrame:self.view.bounds];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM