0

What ways are there to change views other than using a navigation-based app? I want my first view to be basically just a simple form and when the user hits a "submit" button I want to send him over to the main view, without being able to return. And I don't want the bar on the top of the view either.

How can I achieve this, and if possible without losing the animations that come with a navigation-based app.

3 Answers3

0

Did you look at 'presentViewController:animated:completion:' in the UIViewController class description? There are lots of options for how you animate in another viewController.

David H
  • 40,852
  • 12
  • 92
  • 138
0

Sled, you can simply just hide the UINavigationBar for your UINavigationController.

That way you won't see the UINavigationBar and the user will not be able to return back to that page.

You'll need to set a permanent flag in your app either writing to text file or using NSUserDefaults.

Zhang
  • 11,549
  • 7
  • 57
  • 87
0

If you wanted your app to be entirely navigation controller free, you can use one of the signatures of presentModalViewController:animated: from whichever UIViewController you deem best fit to be the parent. Call [self dismissModalViewControllerAnimated:YES] on the child view (form you want submitted) after you've handled state change on submit. One thing to watch out with this, is as of iOS 5, Apple now prefers that you use presentViewController: instead, and presentModalViewController: is marked for deprecation at a future date.

In terms of "how you would know the user submitted the form, so they may now proceed in your application" - one way you could do that is to use delegation / notifications to maintain awareness of the state of the form. When the child form is submitted, you can call the parentViewController's delegate callback to set flags - or return authentication data, for example - in your AppDelegate or some high-level class. Delegation and Notifications are useful tools when using the iOS SDK.

Option two could be using a completion handler in with your call to present the child, such as:

ChildForm *childFormWithSubmit = [[ChildForm alloc] init];
[self presentModalViewController:childFormWithSubmit animated:YES 
                      completion:^(/*inlineFunctionParams*/) 
                                  { /*inlineFunctionBodyToRunOnCompletion*/ }];

Lots of possibilities ~

Community
  • 1
  • 1
Eric Stallcup
  • 379
  • 2
  • 5
  • 15