Search code examples
iphoneuinavigationcontrolleruimodalpresentationformsh

UINavigation in UIModalPresentationFormSheet


Not sure if someone can help me.

I am trying to create a UIModalPresentationFormSheet with navigation. I can load the view but i am not sure how to setup the navigation controller so when a row in the tableloaded loads the edit screen. At the moment it loads a uiviewcontroller with a tableview on it from the main screen. I need to allow editing on the table to add/edit delete records. When the user clicks either add or edit a new uiviewcontroller(detail view) is pushed to screen. It would be better if i had a navigation controller right? but i do need the edit buttons and back on the nave bar.

I think i have the button adding working its more just setting up the navigationcontroller

RootViewController - TableView select a row it loads the DetailViewController

DetailViewContoller - DetailView - Contains a button that loads the FormView as a UIModalPresentationFormSheet see link below.

FormView - Loads UIModalPresentationFormSheet Formsheet - Tableview with data in it. Editing this data loads the FormDetailView http://www.bronron.com/iphoneDev/screen1.png

FormDetail view - viewcontroller with save and cancel buttons on nave bar http://www.bronron.com/iphoneDev/screen2.png

Any help would be greatly appreciated. Many thanks in advance

Thanks, Azz


Solution

  • When you load the UIModalPresentationFormSheet Formsheet, simply add:

    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:/*the formsheet*/];
    

    Then just add navController to the modal view, instead of the root view. Then you will be able to add buttons and push viewControllers, etc.