I have a view “MainView” that has a navigation bar without any navigation controller, also, it has a tab bar without a tab bar controller. each tab bar item has its own view controller. everytime i click on a tab bar item it just removes the current view controller and inserts another view controller.
then, a certain tab bar item has a view “listview” and this view has a uitableview in it, and when i click on an item in the uitableview, it removes the current view and adds another subview “detailview”. but this time, i want to add a navigation button on the current view, so that i can go back to “listview”.
how can i access the navigation bar on the “MainView” from my current view?
It sounds like you are making the mistake of using only views when you should be making correct use of view controllers. If you are a new developer this is especially important to get right.
Your login screen should be a view controller, e.g.
MyLoginViewController. This can initially be therootViewControllerof your main window, or you can present it modally over your main content when the app launches.After logging in, you can either replace the window’s
rootViewControllerwith your main view controller, or dismiss the login screen if you presented it modally.Your main view controller should be a
UITabBarController, and if you want push/pop navigation with back buttons etc. you need to put aUINavigationControllerinside each tab, and then push the top-most view controller onto that.This can all be done very easily using interface builder as well.