3

I am creating a login type functionality for my iphone app. I've laid the whole thing out in storyboard. I have set a condition that keeps the user logged in for a day. Then after that, the application should direct them to the initial view controller (a page where they have to enter login credentials).

I was planning on putting this logic in the AppDelegate (app did load). If there is a better place to put this logic, I'd be open to that. But how do i access and load the initial view controller in my storyboard?

The reason I can't just load a segue to this initial view, is because I won't necessarily know where the user last left the application. And i don't want to create individual segues from each view back to the initial view.

Thanks!

EDIT! In response to Luis's answer Okay, great! I added a navigation controller at the beginning of my starboard, like the first character suggested. Now, I'd like to go back to the navigation controller every time I open, or re-open the app, so that the navigation controller's logic executes. Thanks

Jeff
  • 1,800
  • 8
  • 30
  • 54

1 Answers1

2

Read both of the answers provided for this question, the first approach is easier but you have to do what you just wrote you didn't, the second one is what you are looking for but its way more complicated.

iOS 5 storyboard, programmatically determine path

Community
  • 1
  • 1
Pochi
  • 13,391
  • 3
  • 64
  • 104
  • Okay, great! I added a navigation controller at the beginning of my starboard, like the first character suggested. Now, I'd like to go back to the navigation controller every time I open, or re-open the app, so that the navigation controller's logic executes. Thanks! – Jeff Jun 04 '12 at 18:27
  • The link you provided works great... Until the application gets suspended (the user pushes the home button). When the ApplicationDidBecomeActive gets executed, the app will resume right where it left off. --I don't want this functionality. I'm trying to load the initial view controller again. This is proving difficult to do in the appDelegate. There link you provided suggested that I make the app completely close when the user pushes the home button. Unfortunately, I can't have this happen in my app. So i'm looking for another way to make this happen. – Jeff Jun 05 '12 at 01:00
  • 1
    well then simply set the present view controller that you want on the ApplicationDidBecomeActive. – Pochi Jun 05 '12 at 01:09
  • Great idea! I'm not exactly sure how to do this, without initializing a whole new storyboard. The only examples I've seen were using initNibWithName, and unfortunately, I can't do that. – Jeff Jun 05 '12 at 01:14