Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PushViewController Leads To Black Screen

SettingsViewController *viewController = [[SettingsViewController alloc] init];
    [[self navigationController] pushViewController:viewController animated:YES];

When using this code in a NavigationController the scene shown is just a black screen. In storyboard it shows the content but it is not displayed on the phone.

like image 638
user2080841 Avatar asked Feb 18 '13 03:02

user2080841


2 Answers

Try this:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil];
SettingsViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"setting"];
[self.navigationController pushViewController:viewController animated:YES];

Set the settingviewcontroller's identifier to "setting"

like image 152
shivam Avatar answered Nov 15 '22 19:11

shivam


Use this:

SettingsViewController *viewController = [[SettingsViewController alloc] initWithNibName:@"SettingsViewController" bundle:[NSBundle mainBundle]]; 
[[self navigationController] pushViewController:viewController animated:YES];
like image 29
Vishal Avatar answered Nov 15 '22 17:11

Vishal