Steven Chou
Steven Chou

Reputation: 2215

Segues not working after redirect by program

I trying to redirect from current ViewController to another by code (after login):

//redirect to new view
UITableViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"MenuViewController"];
[self presentViewController:controller animated:NO completion:^{}];

The MenuViewController's segues are not working after redirected, but when I set MenuViewController as app start page, the segues can work.

The segues just a UITableViewController, contains some segues to change between controllers.

Upvotes: 0

Views: 45

Answers (1)

Tim Bodeit
Tim Bodeit

Reputation: 9693

Have a look at what kind of segue you're trying to use.

"Present Modally", "Present As Popover", "Modal" and "Popover" should work fine.

"Show" and "Push" segues require a NavigationController. If you call presentViewController:, you will have to create a new UINavigationController within that hierarchy to use them.

Add a new Navigation Controller to your storyboard, that has MenuViewController as the root view controller and present this navigation controller instead.

enter image description here

Upvotes: 1

Related Questions