Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-16-2011, 02:23 PM   #1 (permalink)
justdan
 
Join Date: Jan 2009
Location: Dallas
Posts: 38
justdan0227 is on a distinguished road
Default Correct way to push/pop ViewControllers

Ok, with the fact that I want to have a main menu screen that I then press buttons to go to other screens has directed me to use a NavigationController.

If my MenuViewController is my main window and I want to go to my LoginViewController first, I simply push the view controller after setting a flag that this is the first time through and so I need to display the LoginViewController.

If I want to do this when the application first launches, I catch the ViewWillAppear and push the LoginViewController correct? (this obviously works). When Login is complete, I inform my MainViewController (through a delegate) that the login is complete and then pop the LoginView Controller. MainViewController gets control and this time when it gets the viewWillAppear it sees that the user is logged in and does not go into the LoginViewController again.

HERE IS THE QUESTION

What if LoginViewController needs to display a RegisterViewController. Do I push another ViewController and once Registered, tell the LoginViewController which when the RegisterViewController pop's and control is passed back to the LoginViewController it sees that the user is "registered and logged in" and so it tells the MainViewController though the delegate that the user is logged in and pops back the MainViewController who's viewWillAppear bypasses the LoginViewController pushing because the user is logged in?

Is there an obvious simpler way to do this? (The animation of the RegisterViewController back to the LoginViewController back to the MainViewController is really bad looking - And don't even get me started on animation because that just really messes everything up)

Suggestions?
justdan0227 is offline   Reply With Quote
Old 08-16-2011, 04:43 PM   #2 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

maybe you can just present a modal view controller w\o pushing it in UINavigationController

View Controller Programming Guide for iOS
__________________
dany_dev is offline   Reply With Quote
Old 08-16-2011, 05:20 PM   #3 (permalink)
justdan
 
Join Date: Jan 2009
Location: Dallas
Posts: 38
justdan0227 is on a distinguished road
Default

Quote:
Originally Posted by dany_dev View Post
maybe you can just present a modal view controller w\o pushing it in UINavigationController

View Controller Programming Guide for iOS

Thanks... Yeah I thought of that too, however if I make the LoginViewController Modal, than I can't "push" a RegistrationViewController on top of it.
justdan0227 is offline   Reply With Quote
Old 08-16-2011, 05:51 PM   #4 (permalink)
vfr
Registered Member
 
Join Date: Jul 2011
Posts: 32
vfr is on a distinguished road
Default

Quote:
animation of the RegisterViewController back to the LoginViewController back to the MainViewController is really bad looking
You could pop directly to either the root view controller or a specific view controller with UINavigationController's -popToRootViewControllerAnimated: and -popToViewController:animated: methods.
vfr is offline   Reply With Quote
Reply

Bookmarks

Tags
uiviewcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 392
13 members and 379 guests
7twenty7, chiataytuday, cristofercolmbos, dedeys78, fiftysixty, gmarro, jimmyon122, jonathandeknudt, pungs, raymng, stanny, tymex, UMAD
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,669
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dedeys78
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:08 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0