iOS Apprentice V6 - Checklists - why using 'show' instead of 'present modally' for add now?

I did the Checklists tutorial in the previous version which has modal screens for the add checklist and add item. I also read that normally ‘present modally’ segues are used for add screens.

But I see that in the V6 Checklists tutorial, all the add screens are using ‘show’ segues. Why?
Is that the new recommended way to do add screens? When would I use ‘present modally’?

Thanks

  • Sekar

The tutorials in the previous (V5) version of the book relied on adding a new navigation controller to make the modally presented screens work. Personally, I do not like adding multiple navigation controllers to the same navigation flow since that results in certain issues, especially with regards to handling rotation, that I’ve seen in other apps.

So, I simplified the app by going with a single navigation controller and a show segue. The app still could have been made to work with a modal segue but this approach was simpler. I do realize that a lot of people advocate using modal segues when it comes to add screens. However, in this particular instance, it doesn’t really matter (in my opinion of course, others might disagree) whether you use a modal segue or a show segue since the screens will behave the same way with either segue.

In the case of macOS (note, I’m talking of macOS and not iOS) modal presentation made sense since it gave you a view or dialog which had to be dismissed before you could proceed with any other action. Under iOS, this doesn’t make a lot of sense since you generally have one view cover the other - so whether you use show segues (which form part of the navigation stack) or a modal segue (which is outside the navigation stack) is largely a matter of taste - again in my opinion, of course :slight_smile:

I would generally use a modal segue if I wanted a screen which didn’t have the navigation UI (navigation bar, tab bar) etc. that comes as part of the existing navigation stack. Otherwise, I personally tend to use show segues since they are simpler and keep all your views as part of the same navigation stack - allowing you to easily jump several views back, if the need arises.

Hope that clarifies things, but if not, please feel free to ask further questions to clarify things :slight_smile:

Thank you for the reply :slight_smile:

Thanks for that explanation. I’ve always wondered why the original did the multiple navigation controller thing.

Hi Fahim,

On page 335, after creating a new UITableViewController and a show segue to it, how do I remove the default “Checklist” back button ? I could not add two new Navigations Items (left and right) having while the back button is still there. Pls help

Thanks

Not sure which edition of the book you are talking about since the sixth edition, which is the latest, does not have anything about back buttons on page 335 … But generally, you should be able to simply drag a Bar Button Item on to the left navigation slot of the view controller on the storyboard to override the back button.

Sorry I am reading with epub file so page index are relative. Anyway, its just my silly mistake trying to use Navigation Items instead of Bar Button Item :slight_smile:
Thanks

This topic was automatically closed after 166 days. New replies are no longer allowed.