Programmatically load the initial view controller from storyboard IOS5 - ios

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

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

Related

How to present navigation controller from a seperate viewcontroller

I am building an Onboarding/Welcome screen for my app, but the problem is that my app has a tab bar, so my Onboarding somehow interferes with that and doesn't look like a seamless interface. My solution is to put the Onboarding thing on a separate view controller and once a user is done with that screen, it presents the navigation controller and all of ITS views. I have done some research on this, but I'm still lost. If you have any other ideas, or have solutions, please let me know, thanks.
Here is what I want to achieve:
In order to do this in a way that looks nice and works well you should not be pushing or presenting the tab bar but updating the root view controller of the whole window.
I can’t provide a code example right now but there will be several online sources for this.
You should be changing the view controller so it essentially toggles the app between “logged in” and “logged out”.
That way you don’t have to worry about how to get from one to the other. They act separately just dealing with their own stuff.

Multiple Segues to one ViewController with NavigationController?

i have one question about using multiple segues to one ViewController. Ill try to create an article management, so you can add/edit/delete articles.
When you add a new article you can choose between a maincategory and a subcategory, choose the article and then edit some inital values.
but if ill try to edit one of my selected articles, i would like to jump to the "latest" ViewController in navigation stack.
I thought i could easily create another segue to my last viewController, but ill always get an error when i try to load this segue (i guess this could be a problem with the existing NavigationController).
I could provide some code, but i dont know if this is a possible solution to solve such things - or is there a better way?
Thanks in advance.
You can, but the new segue should take you to a navigation controller that just contains the last view controller (as the root). In this way you are duplicating the normal situation but with only 1 view controller.
If you wanted to allow the last view controller to have a 'back' button which took you to some 'earlier' screens (if that makes any kind of sense in your app) then you would need to write some code. It's more likely that other screens should be accessed via bar button items or similar (which would also likely be done in code).

How to implement the Facebook App iOS UI with Xcode Storyboard?

I'm trying to build an app that has lots of similarities to the Facebook App in terms of the "Storyboard". I'm tempted to do everything in code as I know best but I'd really like to figure out how to storyboard these more complicated UI's.
The Facebook App starts with a login view. When you log in, you get a tab view. In the main tab view, you have a table view. Within each table view are a user, post, and comment buttons which push to a new view.
So the way I am understanding it is we have UINavigationController with the .navigationBarHidden set to false. The first view controller here is the loginViewController. When the login button is pressed and the user is logged in, we performSegueWithIdentifier to a UITabBarController. The first tab is a UINavigationController with a UITableViewController as the first view controller. Clicking user, post, or comment pushes the appropriate view controller onto the NavigationController.
This all begins to seems a bit more complicated than just writing this all out in code. I'm also not even sure this implementation is correct with all these nested view controllers. I'm not sure this is all possible with storyboard as well: for example a navigation controller for pushing to comment, user, or post views doesn't seem possible with storyboard.
I'd like to know the correct way of implementing this kind of UI design. And should / could this be implemented using Storyboards?
Your design team may layout the app using a "storyboard" (physical objects -- not the digital version). Large apps are hard to piece all the little things together on a storyboard. Just too many wires going every which way.
Look at the FB app without internet access and you can see their basic building blocks easier. Its built in units (post at a time) that are added to a scrolled view. Search bar and menus at the top and buttons at the bottom with the scrolled view in the middle. The posts probably have some common base class with various types derived from it (picture, video, links, etc).
There is some sort of background process monitoring the position of the scroll view to dynamically load new stories if you get down within 1/3 of the way to the bottom. Within each post you can see the components if you look closely and think about what sort of block that is.

Best way to combine UI Navigation Controller with UITabBar Controller?

I'm at a point in the development of the app I'm working on where in order to complete the assignments given to me, it seems like the best way to accomplish what I need is to combine a UINavigationController with a UITabBarController.
Structurally, the app has a home page, and the rest of the app is navigated through the UITabBarController. This is a sound design for the original, but when I took over the development process of this, I had to make a lot of additions to the app, and there's technically supposed to be a "second" section which adds extra "features" if you will that aren't necessarily related to the main functionality of the app itself.
Basically, since everything begins at the Overview, the user is supposed to have a choice between just diving into the app itself, or using some of these extra features. I'm thinking the Navigation Controller would be fitting for the extra features, but I'm not sure how I can add to it.
What I need to know is - is this solution to the problem sound? If so, what's a good way to accomplish this? Is it ok to have a separate UIWindow class to link the Navigation Controller up with the TabBar Controller?
Granted, this app has used a lot of nib files, and every time I've tried to do something programmatically, it just hasn't worked. Thus, if someone could point out a NIB method of achieving this, I'd appreciate it.
According to Apple recommendation, UITabBarController should always be the root view controller of your app. So basically your main view is just one tab of your tab view controller, and so you just need to embed your main view controller in a navigation controller. This way you can navigate to whatever page you wish within that tab using the navigation controller, or you can go to other tabs using the tabbar controller.

How to make viewViewAppear getting called in both Master and Detail view whenever they appear

My app has 5 screens which are controlled by a tabbar at bottom, and one of them is a SplitView.
My Problem is:
The master view is just cause viewWillAppear only one time at first rotation.
The detail view is also just cause viewWillAppear only one time at first load.
While I would like viewViewAppear of both master and detail view are getting called each time this screen is opened, because there are 5 different screens, and user may leave this screen to view another, so I would like to know whenever master and details view appear to change layout or refresh data.
Please help me, thanks in advance!
It looks like you just anwsered your own question. I know its something you dont want to hear but apple's documentation says it must get the root view. Try to restructure your app a bit.
Link to documentation:
http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/iPadControllers/iPadControllers.html#//apple_ref/doc/uid/TP40007457-CH6-SW2
From the documentation:
A split view controller must always be
the root of any interface you create.
In other words, you must always
install the view from
aUISplitViewController object as the
root view of your application’s
window. The panes of your split-view
interface may then contain navigation
controllers, tab bar controllers, or
any other type of view controller you
need to implement your interface.

Resources