Is the design of being able to push indefinite view controllers on a navigation stack acceptable?

axl411

If inside my app, I can push like this (A, B and C represent some view controllers): A -> B -> C -> B -> C -> B ....., this can go forever, is this an acceptable design pattern?

This may seem a silly and obvious question but I have this app called "Taobao" (China's biggest, most famous online shopping app) from Alibaba Group (owned by China's richest man), it is exactly like what I described above. In the app I can go like A -> B -> C -> B -> C -> B .....then if I need to go back to A I need to go back as many times as I go deeper, which means all view controllers are pushed on the stack during the navigation.

Since Alibaba Group is a very trusty tech company so I believe this navigation pattern is there for a reason. My common sense tells me it is not a good pattern but I want to hear from you experienced guys. Thanks!

Viktor Kucera

Generally you can push anything which makes sense for your app. There is just one (pretty obvious condition) - do not push controller which is on top of your stack.

But there is a big BUT! If your stack can be really infinite you have to keep in mind that navigationcontroller stack is stored in memory! Adding more and more controllers on the stack without releasing any of them will end up, sooner or later, with memory crash. That's why you cannot use just simple pushViewController method. You can reconsider setViewControllers along with some other helpers to keep your stack at reasonable size. Or limit it to specific number based on memory usage observation. I believe there are plenty of options but that growing memory is a point which you should keep in mind.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Navigation Controllers/View Controllers working with a stack

From Dev

Navigation Controllers/View Controllers working with a stack

From Dev

Do the View Controllers Popped Out of the Navigation Stack Dealloc?

From Dev

Remove intermediate View Controllers from Navigation Stack - iOS

From Dev

dismissing a stack of view controllers

From Dev

Push view: while an existing transition or presentation is occurring; the navigation stack will not be updated

From Dev

View controllers that are still open are keeping my app from being able to quit

From Dev

How can I manage the potential endless pushing of view controllers onto the navigation controller stack? iOS

From Dev

Dismiss navigation controller and all of its view controllers stack in UIPopupview using a button within one of the views

From Dev

Dismiss navigation controller and all of its view controllers stack in UIPopupview using a button within one of the views

From Dev

Swift iOS -How to print a list of all Child View Controllers in Navigation Stack that haven't been pushed on yet

From Dev

Navigation Controllers with the same root view

From Dev

Navigation between view controllers is not worked

From Dev

Push multiple view controllers in storyboard

From Dev

Push multiple view controllers in storyboard

From Dev

How to create a sequence of modal/push segues between few view controllers to keep all the push/modal views on the same stack? (using nibs)

From Dev

Rebasing master without being able to push --force

From Java

Instead of push segue how to replace view controller (or remove from navigation stack)?

From Dev

Remove view controller from navigation stack after push segue (using Storyboard segues)

From Dev

NSURL not being passed between view controllers

From Dev

SpeedFan suddenly stops being able to detect controllers and sensors mid game

From Dev

Accessing Array of View Controllers on Stack in Swift

From Dev

How to know which views (or view controllers) are on stack?

From Dev

Combining Tab Bar, Navigation and Table View Controllers

From Dev

Simple, custom navigation between 4 view controllers

From Dev

remove border of navigation bar for few view controllers

From Dev

Combining Tab Bar, Navigation and Table View Controllers

From Dev

Add navigation to existing view controllers / segue

From Dev

remove border of navigation bar for few view controllers

Related Related

  1. 1

    Navigation Controllers/View Controllers working with a stack

  2. 2

    Navigation Controllers/View Controllers working with a stack

  3. 3

    Do the View Controllers Popped Out of the Navigation Stack Dealloc?

  4. 4

    Remove intermediate View Controllers from Navigation Stack - iOS

  5. 5

    dismissing a stack of view controllers

  6. 6

    Push view: while an existing transition or presentation is occurring; the navigation stack will not be updated

  7. 7

    View controllers that are still open are keeping my app from being able to quit

  8. 8

    How can I manage the potential endless pushing of view controllers onto the navigation controller stack? iOS

  9. 9

    Dismiss navigation controller and all of its view controllers stack in UIPopupview using a button within one of the views

  10. 10

    Dismiss navigation controller and all of its view controllers stack in UIPopupview using a button within one of the views

  11. 11

    Swift iOS -How to print a list of all Child View Controllers in Navigation Stack that haven't been pushed on yet

  12. 12

    Navigation Controllers with the same root view

  13. 13

    Navigation between view controllers is not worked

  14. 14

    Push multiple view controllers in storyboard

  15. 15

    Push multiple view controllers in storyboard

  16. 16

    How to create a sequence of modal/push segues between few view controllers to keep all the push/modal views on the same stack? (using nibs)

  17. 17

    Rebasing master without being able to push --force

  18. 18

    Instead of push segue how to replace view controller (or remove from navigation stack)?

  19. 19

    Remove view controller from navigation stack after push segue (using Storyboard segues)

  20. 20

    NSURL not being passed between view controllers

  21. 21

    SpeedFan suddenly stops being able to detect controllers and sensors mid game

  22. 22

    Accessing Array of View Controllers on Stack in Swift

  23. 23

    How to know which views (or view controllers) are on stack?

  24. 24

    Combining Tab Bar, Navigation and Table View Controllers

  25. 25

    Simple, custom navigation between 4 view controllers

  26. 26

    remove border of navigation bar for few view controllers

  27. 27

    Combining Tab Bar, Navigation and Table View Controllers

  28. 28

    Add navigation to existing view controllers / segue

  29. 29

    remove border of navigation bar for few view controllers

HotTag

Archive