views:

31

answers:

1

Is it possible to decide the number of hierarchical level dynamically in UINavigationController in iPhone ? Actually, in my application I have to display hierarchical data but I don't know the number of levels at the coding time. The number of levels can be increase or decrease. The exact number of levels will known to me at the time of display. Please suggest the related code if possible.

With regards,

anurag85

A: 

I think you misunderstood some concept of navigation controller.

When navigation controller is created you push the first (root) controller that is viewed. When user performs some action, you create another controller and push it into the hierarchy with pushViewController:animated:. From that screen you can again create and push another one, then another and so on. When user wants to come back, he can use navigation bar's "Back" button. As he is navigating back, those controllers are being released and possibly deallocated (if you did not retain them for possible reuse).

Michal
Thnx for reply, But i wanted to know that can we shall have decided the numbers of levels at the run time. I do not find any thing related to this on net, so i asked the question for confirmation only.
anurag85