UIWebView error on Tab Bar Controller
I really need help on creating a UIWebView on a Tab Bar Controller. But I Bumped into a road block.
Basically I started out with the Tab Bar Application Template, then;
- Removed the First and Second开发者_开发百科 Controller XIB files on the resource folder (since it's not really needed
- In Interface Builder, I removed default contents in the First and Second View Controller and added a View first, then a Web View after that on both the View Controller
After that, I started coding on both on the First and Second View Controller headers with just this code:
@interface FirstViewController : UIViewController { IBOutlet UIWebView *twitter; }
(also for the Second View Controller's header)
Then I linked the Outlets to the UIWebView and linked both Tab Bar Item to their Class View Controller (First Tab Bar Item linked to the FirstViewController class, then for the second one as well)
Later in both the View Controller's .m files, I added
- (void)awakeFromNib
{
[twitter loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"twitter.com"]]];
}
(and for the other one)
Now when I compiled the application, it gave me:
'First View Controller (First)' has both its 'View' and 'NIB Name' properties set. This configuration is not supported.
I looked through every youtube video about this topic, but none of their comments even mentioned anything about this kind of error, I hope someone can explain how to get through this error, thanks
In Interface Builder you can either define a view in your MainWindow.xib directly inside the TabBarController, or you can tell Interface Builder that those views are loaded from separate XIB files.
It sounds to me like you are defining the views directly inside your main XIB, so in that case you need to select the view controllers that are in the TabBarController, hit Apple-1 to open the attributes pane for the controller, and clear the "NIB name" field which is probably still set to "FirstViewController". Do the same for any other view controllers you have in your TabBarController.
精彩评论