views:

8

answers:

0

I am very new to iPhone Programming, so this question may seem a little silly...

I am developing an app which is a UIViewController Based application. so when you run the app a Main View will be shown which is a Full Screen View and is actually my Main Menu Window. i have a few menus inside. when i click any of these menus, i will load another UIView on top of the main view with a Navigation Bar.

What i do is that i have a button in the mainView (consider it a menu) that initializes a UINavigationController loaded with my new UIView. from this new View, i have a few other subviews which i can navigate in and out using basic methods of UINavigationController.

I have added a UIBarButtonItem to my navigationcontroller in order to be able to go back to the main menu. what it does is just remove views from superview and go back to the main View.

2 problems:

  1. when i click the UIBarButtonItem to go back to main menu, i actually remove the subviews until i reach the MainView. but here, the NavigationBar still remains on top. i dont know how to destroy that, because i actually alloc and init the navigation bar in the MainView class. but the UIBarButtonItem is created in the subview classes. so when the action is fired, i only have access to objects in the subview classes and not the MainView Class? how should i proceed?

  2. i have about 6 views in my Navigation View Hierarchy. the UIBarButtonItem that i have created exists in all these Views. as i said before, what it does is that it actually calls removefromsuperview method. but what if i want to jump from the last subview (e.g. subview number 6 in the hierarchy) straight to the MainView? what method to call when the UIBarButtonItem is pressed...???

Thanks in Advance!