MonkeyBlue
MonkeyBlue

Reputation: 2234

iOS Storyboard Conditionally showing Views

I am currently working on a project for the iPad using Storyboards for the 1st time and I am wondering if my approach is the correct way to do this.

The first ViewController in this example is actually a split view controller.

Currently within the iPad app when a user clicks on the Export Features Button I am conditionally requesting the segue based on some code / checks I am running

    [self performSegueWithIdentifier:@"subscribe" sender:self];
    [self performSegueWithIdentifier:@"filterOptions" sender:self];
    [self performSegueWithIdentifier:@"showExportedDoc" sender:self];

However I am not sure if I should have 3 navigation controllers and also when a user clicks on the Buy button in the subscribe View Controller it pushes to the Filter Options View which is actually nested in another Navigation Controller.

Any help / advice on this would be great as I mention I am just not sure if I am following the best approach with this.

Thanks

Storyboard Layout

Upvotes: 10

Views: 620

Answers (1)

Mamouneyya
Mamouneyya

Reputation: 632

... and also when a user clicks on the Buy button in the subscribe View Controller it pushes to the Filter Options View which is actually nested in another Navigation Controller.

Well, I think you have some misunderstanding here. The fact that the filter options view controller is embedded within a navigation controller in your storyboard doesn't mean that it will be instantiated with the UINavigationController when you're pushing it within the current navigation controller (It will be so though if you connect the segue to the UINavigationController that it's embedded into).

To answer your original question, I don't see right and wrong approach here. It all depends on the structure you would like to have. For me, I guess I would prefer to have only one UINavigationController that manages everything (set it as an initial view controller and embed your home view controller within it). This would provide a more consistent navigation experience to the user, plus more consistent look (navigation bar would be shown from the beginning).

Upvotes: 2

Related Questions