0

I just updated to xcode 6.2 and am having an issue displaying a newly created view (in the view controller called myController) called through:

[self.navigationController pushViewController:myController animated:YES];

viewDidLoad and viewWillAppear are both called fine within myController (i.e. NSlog output seen in console) but for some reason the interface of the created XIB stays blank. The navigation control works and is above the blank screen. This occurs when running on the simulator and on the device.

Older view controllers are not having this issue when they are called by identical means within the same app. Interestingly, a dynamically generated view displays but a new view created within interface builder stays blank. I have tried copying an old XIB and creating a new one, but the Interface will not be displayed (simple screen with one button).

All steps of adjusting the new view in the rootcontroller have been performed, it just seems that the XIB will not be displayed. There is absolutely no error output in the console indicating that anything is wrong.

Any ideas, workarounds, log files to check? (besides using an older version of xcode).

thanks

nburk
  • 22,409
  • 18
  • 87
  • 132
  • My first guess is self.navigationController is nil... Does your view controller have one? Add `NSLog(@"%@", self.navigationController);` before that line. – Mike Mar 30 '15 at 14:57
  • I'm going to have to check that later, but a NavigationController has definitely been configured in the Delegate files. I'm not sure why the NavigationController would be nil for one TableView launch option and not another. It is a mature app that I am in the process of ehancing. – DieEchtenProfis Mar 30 '15 at 15:35
  • self.navigationController was not nil. Only option seems to be to build the interface programmatically – DieEchtenProfis Apr 01 '15 at 18:25

2 Answers2

0

If you copied views form an older XIB file which didn't use AutoLayout, and the new XIB/Storyboard does, chances are the layout constraints are messed up. Check if your current XIB/Storyboard uses Autoayout and either disable it or set it up properly for all views and subviews.

EDIT:

For the new XIB which contains your button, confirm the autolayout button is unchecked in the file inspector to make sure you are not using AutoLenter image description hereayout -

Community
  • 1
  • 1
Swapnil Luktuke
  • 10,385
  • 2
  • 35
  • 58
  • I don't use Autolayout and I tried an extremely simple view which should just display a button and a red background so there should not be any constraint difficulties. But I have no idea if problems could cascade within the project if I copied an earlier XIB on a different controller. I don't know which files to check to see if such problems exist. – DieEchtenProfis Mar 30 '15 at 15:40
  • Autolayout was not checked – DieEchtenProfis Apr 01 '15 at 18:26
0

Thread originator here....... I eventually got it to display by explicitly calling

myController = [[myController alloc] init];

before

[self.navigationController pushViewController:myController animated:YES];

For previous view controllers, the alloc seems to have been done implicitly. Not sure how/why. Thanks to all who replied.