ASN ASN - 1 year ago 135
Objective-C Question

Navigation between Controllers - Black Screens

I'm trying to work on a simple login application which on successful login displays a menu page. On the action sheet of menu page, we have an option of looking at all the users logged in that phone and clicking on any user, it should do some login processing and direct to menu page again. This is how the workflow should go on.

Below is the image that explains it.

enter image description here

All the controllers are connected to segues except for accounts controller and middle controller. Navigation between those two is done using

as I had to pass some info from accounts controller(table view controller with list of all users) to middle Controller.

MiddleController *maController = [[MiddleController alloc] init];
if (maController.view) {
maController.ma_userId = mo_userId; // Set the exposed property
maController.ma_password = mo_password;
[self.navigationController pushViewController:maController animated:YES];

Middle controller is doing all the process perfectly after getting the details. But directing to menu controller is where I'm facing the problem. If I use a segue between middle controller and menu controller an error is thrown saying
no identifier with the name segueName found
. But if I use a
then it is displaying a blank black screen. Can some help me to solve this.

This is how I'm pushing it:

MenuTableViewController *mapMenuTableviewController = [[MenuTableViewController alloc]init];
[self.navigationController pushViewController:mapMenuTableviewController animated:NO];

I've tried all the ways that are posted in previous SO questions, but nothing helped.

Thanks in advance

Answer Source

Try not to alloc-init, but instantiate it fom storyboard like this (you should add it a storyboard id)

YourViewControllerClass *viewController = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:@"ViewController"];

And then push it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download