Iphone application with login - ios

I make iphone application. I use for root controller tab bar controller. One of my tabs is "My profile". In this tab I want to have two navigation view controllers. First controller should appear when user is not logged in. When user log in it should view second navigation controller. But I don't know how to do this. Can some one give some start point. Thanks.

You can use these links for your help.
Login Screen
screen switching

Related

Walkthrough with tab view controller

I have been attempting to create a walkthrough for my app although I also have a tab view controller which is the initial view controller. I have been able to identify when a user is opening the app for the first time, but when I make the walkthrough view controller initial, I get a Sigbart error. This is because I set up my tabbar in the app delegate.
Is there a way to possibly keep the tab bar VC the initial and hide the first VC if it is the users first time opening the app?
Is there another way of doing it?
I dont know the code to check of its the flrst time a user opens an app, but why dont you make that check on your tab bar controller? And then lf lt ls the first time, you just change the root vc to the tutorial vc. When they are done with the tutorial you just change back the root vc to the tab bar.
There easiest way to accomplish the tutorial-like behavior for new users is:
1) Make a new View Controller be the initial one.
2) Add code to check if its the first time the user launched the app. If it is, show the tutorial, if its not, show your tab view controller.
3) You can fill this "fake initial" view controller with the same image shown in the splash screen. This way the user will feel its just the splash one.
*) An added benefit of this approach is that you can check other useful things. For example, if your app has some kind of login feature you can manage it here skipping the login window for users who have already logged in. It can also be used to update your app's resources in case you are retrieving them from a server.

Setting different view controller for one tab

I have 5 tab in my tab bar controller. Users can use my application as anonymus user. One of my tabs is Login page. if user logged in my application, that tab should be Home page. but I don't know how set different view controller for one tab based on if condition
One of the possible solutions is to use container view controller.
So, your view controller will have 2 embedded view controllers, and in code you can choose between them based on your logic.
There you can find some relevant examples and topics:
https://developer.apple.com/library/content/featuredarticles/ViewControllerPGforiPhoneOS/ImplementingaContainerViewController.html
iOS Switching an embedded view in storyboard
Embed UIViewController Programatically?

how can i add tab bar controller to my middle of my app with navigation controller

I am developing simple app in iOS 7. I need to put a tab bar controller in my middle of my app - middle meaning the first 2 views containing signup and signin view with navigation controller. After login, my home view will be displayed. I want to show tab bar controller on my home view.
Please help me with my first app.
Thank you for your help.
Considering that you will need to go back to Signin if you signout within the app, it would make more sense to keep Home View separate from the Signin View. And if you signin, you just change the root view controller to the Home View.
If you need to have Push Segue between Signin and Home, you can use Tabbar inside Home View and adjust it to do what UITabViewController does and still live in the medium that "it is a view controller."

UINavigationController limited utilization in app design

I am using the NavigationController (Embedded via Editor drop down menu in xCode) to control navigation on sign-up and sign-in views, all from landing view when app first launched.
After user sign-up or login, I would like to initiate a view controller with no relation to the NavigationController. Nonetheless, from Sign-up and Login views, I have a segue that links (upon successful authorization) to the main view of logged in users. How can I remove the navigation controller from a certain part of the application because it is no longer needed? Otherwise, each time I add a new view controller, it shows the navigation bar in it which is not ideal for design.
Thanks and image attached shows what I need illustrated.
As far as I am concerned you can remove only view controller from navigation stack. If you do not want navigation bar to be visible, then just hide it in viewWillAppear of view controller that you want to be without navigationBar.
[self.navigationController setNavigationBarHidden:<#(BOOL)#> animated:<#(BOOL)#>]

iOS views navigation best practices

I'm very new in iOS dev (but have more then 10 years overall experience with other platforms so it should help). Now I have to create relatively complex iOS application and do it very fast :).
I created application based on 'Tabbed Application' template using storyboard. Then I added login view that uses JSON to communicate with web application. I made this view initial (first that user sees) by moving appropriate arrow from default tab bar controller to my 'login view controller'.
On the login view I have text fields and login button. By clicking button application verifies user's name and password and then navigate him to default tab bar controller (created by Xcode). I do it with this code:
WPFirstViewController *fvc = [self.storyboard instantiateViewControllerWithIdentifier: #"TabBars"];
[fvc setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[self presentViewController:fvc animated:YES completion:nil];
Everything works fine, but I'm confused than I didn't use graphics lines between views on storyboard and I'm not sure that my approach is correct.
So, questions is how should I navigate user from the login view to tab bar controller? What is the best way in my case? And also, how for example should I navigate user from one of the tab view controller pages page (for example, by clicking button 'Settings') to corresponding view and then back? Maybe somebody could share a link to some good article.
Sorry for the long text. Thank you in advance for your help!
Modal view controllers are supposed to be used for cases where you need to get some critical information from the user (or present some to the user), without which you can't continue with the app. A log in controller would be a good choice for a modal view controller, but your main controller, your tab bar controller isn't. It would be better to present the login controller modally from the controller in the first tab of your tab bar controller. If you do this from viewDidAppear, and with no animation, it will be the first thing the user sees. When the user successfully logs in, just dismiss that controller, and you'll be ready to go in your first tab.
I'm not sure what you mean by your second question. The user navigates between the tabs by clicking on a tab -- you don't need to do anything in code for that.
I would advise you not to use storyBoards. Also, if you are planning to have a navigation controller on your app, then you will definitely use the feature of pushing view controllers on a self.navigationViewController of your view controller. It's easy to use, really easy!!
Typically, login view controllers should be modally presented with: presentModalViewController:animated:
In regards to your UITabBarController, each tab can be a UINavigationController, which will enable you to maintain a stack of UIViewControllers.
All the remains is determining whether the view controller you want to present is modal, or part of said stack.

Resources