Simon.
Simon.

Reputation: 1896

Blank view after pushViewController

Returning to iOS development after a year break, and its all mayhem.

When executing the 3 lines of code below, i see the screenshot of the emulator below.

I've also attempted to add the LoginForm view controller as the root view controller, as it should, except i also see a blank screen.

As shown in the screenshot of xcode, the naming all matches up. All the constraints are also blue.

I've included a NSLog in the viewDidLoad of the LoginForm, that i have seen log at points, but still nothing is displayed.

What am i missing, or doing wrong? I've got nothing from errors to work with.

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *view = [storyboard instantiateViewControllerWithIdentifier:@"LoginForm"];
[self.navigationController pushViewController:view animated:YES ];

enter image description here enter image description here

Upvotes: 1

Views: 705

Answers (2)

Rakesh Salian
Rakesh Salian

Reputation: 159

Try using

[self presentViewController:myVC animated:NO completion:nil];

Because your storyboard doesn't seem to be using navigation contoller.

Upvotes: 2

Vikas Rajput
Vikas Rajput

Reputation: 1874

If you Have Xib File

   Viewcontroller1 *viewController = [[Viewcontroller1 alloc] 
   initWithNibName:@"Viewcontroller1" bundle:nil];
   [[self navigationController] pushViewController:viewController animated:YES];

if you have Storyboard

 Viewcontroller1*vc=[self.storyboard instantiateViewControllerWithIdentifier:@"Viewcontroller1"];
 [self.navigationController pushViewController:vc animated:YES];

Upvotes: 0

Related Questions