0

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

Aaron Stephenson
  • 112
  • 1
  • 11

3 Answers3

1

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.

Andrew
  • 3,874
  • 5
  • 39
  • 67
  • Something like this? SystemPickerViewController *controller = [[[SystemPickerViewController alloc] initWithNibName:@"SystemPickerViewController" bundle:nil] autorelease]; controller.delegate = self; controller.modalPresentationStyle = UIModalPresentationFormSheet; controller.originalSystemName = currentSystem; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller]; [self presentModalViewController:controller animated:YES]; – Aaron Stephenson Jul 04 '11 at 08:10
  • Yes, thats it; except change the last line to: `self presentModalViewController:navController animated:YES];` – Andrew Jul 04 '11 at 17:35
  • I did that and it doesnt seem to load the mini view (UIModalPresentationFormSheet) it loads like a normal tableview eg the full size of screen – Aaron Stephenson Jul 04 '11 at 20:40
  • Do i need to create a new UINavigation controller for the UIModalPresentationFormSheet? – Aaron Stephenson Jul 05 '11 at 07:20
  • Sorry, I'm not quite sure what your asking. But that sounds right – Andrew Jul 05 '11 at 08:01
0

UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:viewController]; nav.modalPresentationStyle = UIModalPresentationFormSheet;

Piotr Chojnacki
  • 6,837
  • 5
  • 34
  • 65
Xianng
  • 342
  • 3
  • 14
0

Apple has ample documentation on these basic topics. Have a look at the Sample Code and Table Guide.

Rayfleck
  • 12,116
  • 8
  • 48
  • 74