简体   繁体   中英

Navigation Controller goes to blank screen

I've developed an app using xcode 4.2 and storyboard and yesterday when I tried to build it for ios 4, I was surprised to find out that storyboard is only supported from IOS 5. Thats not good... So now I am working on changing my whole storyboard to XIB files which I know nothing about. So here is my problem - I have a navigation controller (log in screen) which (if the log is succesful) navigates to a tableview. Now when a row is selected I want to navigate to another view.

I created a DataView and wrote:

DataView *d = [[DataView alloc] initWithNibName:@"DataView" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:d animated:YES];
[d release];

I have an XIB file DataView.xib: There I inserted a UIViewController which has a view and inside that a label. And in the attribute inspector I wrote DataView in the NIB Name.

Yet, when I select a row it just goes to a blank screen. What am I missing?

I'd realy appreciate your help.

You don't need the view controller in your NIB file.

Add a view and any subviews you may want, then make sure the File Owner on the nib is set to your view controller, then option click & drag from the view to file owner and select the view outlet.

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