开发者

Displaying a website in UIWebView

Hey, I am using a Tab Bar Controller template to display a website in different tab bar items. I've set up a View and UIWebView in MainWindow.xib in each of the Tab Bar Items (I deleted the First and Second View Controller xib files on each of those Tab Bar Items since it's not really needed and that it is easier to edit in MainWindow.xib in the Interface Builder)

I don't know if this question has been asked before, but for some reason, it is not displaying a website i.e. google.com

This is the code that I was using to display them:

In the FirstVi开发者_C百科ewController.h:

@interface SEO : UIViewController {
    IBOutlet UIWebView *google;
}
@end

Then for the FirstViewController.m:

- (void)awakeFromNib
{
    [google loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
}

At the end I've linked up the UIWebView to the File's Owner and then I erased the NIB Name field to blank that way it won't cause this error when compiling:

UIWebview has both its 'View' and 'NIB Name' properties set. This configuration is not supported.

Now when I compiled and run it, it is displaying completely blank, it's not displaying a web browser, it is just blank white.

I hope someone can please help me soon with this! Any new or edit coding can really help me, Thanks!


You should not have made the UIWebView the File's Owner. You should make FirstViewController the File's Owner, and then tie the UIWebView to google.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜