Confused about storyboards and ios software Objective C

I really got confused about the relationship between the collapsible files and the programmatic translation of the views.

I am using SWRevealViewController to display a menu of items.

If I click on the storyboard using

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; PhotosViewController *controller = [storyboard instantiateViewControllerWithIdentifier:@"PhotosViewController"]; [self presentModalViewController:controller animated:YES]; [self.navigationController pushViewController:controller animated:YES]; 

All the information in my storyboard is displayed, but the SWFevealViewController button is missing.

If I click on the view controller using

 PhotosViewController *frontViewController = [[StreamScreen alloc] init]; newFrontController = [[UINavigationController alloc] initWithRootViewController:frontViewController]; 

Then I can see everything that I added programmatically, but nothing from the storyboard.

My question is how can I access things from both the storyboard and the things that I added programmatically.

+5
source share
1 answer

if you are presenting a view controller, then it will not give you the default back button, because when you present the controller, it will not be added to the navigation stack in the NavigationController, so it will not give you this option.

If you want the push controller not to use presentModalViewController .

Try below

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

and if you want to introduce the controller, then create manually add the "Back" button, as we have in the "Back Back" button by default, and on it click the "Code" button below to close the controller.

 [self dismissViewControllerAnimated:YES]; 

Hope this helps you.

+3
source

All Articles