简体   繁体   中英

How to create a navigation controller based view from a simple uiview?

I have a simple uiviewcontroller with 4 buttons. Every buttonclick event loads a different image on the view. However for the 4th button i want to launch a navigation controller based uiview with a uitableview. The table view can then have 3 levels which define the settings for the application.

On selecting a row in the uitableview on the 3rd level i need to return to my main view with the selected row index.

How can i add a navigation based view which will be launched on a button press event and the first view of the uinavigationcontroller should compose of a back button which will close this navigation view and return to main view.

TIA,

Praveen S

Edit: My first(home) view does not need a navigation bar. The view launched from the home view should however consist of a navigation bar with back button.

if(nxtv12==nil){
    nxtv12=[[v12 alloc] initWithNibName:@"v12" bundle:nil];
}   
[self.navigationController pushViewController: nxtv12 animated:YES];

and for coming back to home.

[self.navigationController popToRootViewControllerAnimated:YES];

Create a UINavigationViewController object in the current UIViewController (or use self.navigationcontroller) and push the new UIView into the navigation controller. To come back to the same view, use popToRootViewControllerAnimated in the new UIView class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM