Modal View Controller Undesirably Hides Tab Bar - iphone

I am working on an application that requires user authentication to access a profile. The profile section is located solely under one tab (and all others tabs do not require authentication). I currently present a authentication view controller modally (and then dismiss on success) when the user selects the profile tab. However, this approach prevents the user from deciding not to register / login (that is, all tabs are hidden once the authentication screen is presented modally). I don't want the user to be able to dismiss the modal view controller, but rather have it modal only for the profile tab. Is this possible? Can I have tabs visible while having a modal view controller? What is the best approach here. Thanks.

The entire point of a modal dialog box or view controller is to force the user to look at or do whatever the modal view is requesting, and prevent them from doing something else with that application. It seems to me that the best approach, if you still want to use a modal view controller, would simply be to have a "Cancel" button or something on the view controller. Since the profile tab can only be accessed after authentication in the first place, just have dismissing the view controller make the last-viewed tab the active tab.

Xcode 10:
In the Attributes Inspector, inside View Controller section, you've the Presentation option.
a) If you choose Over Current Context, the modal view just will appear over the view, but the Tab Bar will appear at the top of the view.
b) Otherwise, if you choose Over Full Screen, the modal view will appears over all the UI, including tab bars.

Related

Navigation between view controllers

On my application, I have four view controllers (VC):
HOME
MESSAGES
PROFIL
SETTINGS
On each VC, an opaque bar bottom with four bar button items for each VC (home, messages, profil, settings).
When I tap on one bar button item, I manage the navigation with a segue (show) and it loads the selected VC.
I would like to find a way to not load again a VC already loaded one time.
For example:
The app is launched
HOME VC is loaded and appears
User taps on PROFIL
PROFIL VC is loaded and appears
User taps on HOME
HOME VC appears without calling viewDidLoad method, because it has already been loaded four steps ago
I tried with all types of segues (show, present modally, etc.) and with presentViewController method, but each time the viewDidLoad method is called.
Is there an easy way to do this or do I have to manage this with a boolean to indicate that the view was already loaded?
I would like a menu like WhatsApp application has for example.
WhatsApp uses a Tab Bar at the bottom. Are you using Toolbar? ViewDidLoad only executes once per view unless you unload the view from memory.
The easiest way to adapt your app is to just add a Tab Bar Controller in your app and then delete the 2 automatically added view controllers and set a relationship (just like a segue; it's below segue types) between each view controller and the tab bar controller. To change the icons, modify them in the Tab Bar Controller View. Then segues will work automagically just like in WhatsApp. :)

Navigation to Main Root Controller from Tabbar Controller

I am using storyboard, navigation controller in iPhone application. Then navigate it to another view where I have used Tabbar controller. Then in Tabbar controller, I've 3 tabs and each of them have their separate navigation controllers.
Now, After completed process. But when I navigate to Root, it does back with its own navigation controller inside of Tabbar controller.
Actually, I want to come back on main Navigation Controller of an application where application starts.
Basic Flow :: Main Window -> Navigation Controller -> Tabbar Controller -> Navigation Controller -> Button..
So by clicking on Button -> Back to Main Window... Any Idea to back to main root view.
But I'm stuck with this issue for navigation controller that can't back me to the application root.
Can anyone solve this issue?
Please tell me ASAP.
Thanks in advance.
Not really the answer you're looking for, but FWIW:
You should avoid hiding tab bar controllers inside other controllers so that the tab bar controller appears and disappears. This isn't how they are meant to be used. They're supposed to be a main part of the UI and if I see a tab bar controller I expect it be there at the heart of the UI, controlling access to the main parts of the UI, and visible pretty much all of the time if not all of the time.
Don't take my word for it, listen to Apple:
Appearance and Behavior
A tab bar appears at the bottom edge of the
screen and should be accessible from every location in the app. A tab
bar displays icons and text in tabs, all of which are equal in width
and display a black background by default. When users select a tab,
the tab displays a lighter background (which is known as the selection
indicator image) and its icon receives a blue glow.
Don't be terribly surprised if your app gets bounced from the app store for ignoring the human interface guidelines!
It's resolve with ::
[self.parentViewController.navigationController popToRootViewControllerAnimated:YES];
Enjoy coding..!!

iPhone Login -> tabbarcontroller

I have created an app and a login and would like to join them together with no luck. The app has a tabbarcontroller with navigationcontrollers via tableviewcells to drill down to other views of the app.
As I am having no luck in joining the two. I have tried to build on from the login that I have done. I can push to a new view but it does not show a tabbarcontroller etc on the next view. I have seen various forums with people having this problem as well.
So, my question: How can I make a new page (login) open to a TabBarController instead of a view (in the middle of my app, not at the launch)?
Does anyone out there know how to solve this issue?
Use navigation controller in tab bar controller. lets say the navigation controller is its first view controller. Now when the root view controller of the navigation is being displayed, you can see the tab bar. Now if you keep pushing new view controllers in this navigation controller, the tab bar wont hide itself.
However if you present some view controller modally, it would hide itself.
As far as login is concerned, i will check if user has logged in or not. if no, then i would set the root view controller of navigation controller as loginviewconroller else some home page.
I would check the if the user is logged in in the first viewController that get loaded.
From there I would present the loginViewController via the presentModalViewController method.
The use will not see the tabbar if you set the withAnimation:NO.
Now just dismiss the login viewcontroller when the use is logged in.
One could also send a notification that the is logged in, so that viewcontrollers can update them self for the no logged in user.

Iphone UITabbarController

I have a iPad application where i am using more than one Views. The thing is i want to display the TabbarController page while clicking on Button that is on main page. I am able to call the TabBarController directly from delegate method like adding TabBarController to MainWindow in Inspect window. But the thing is i am asking for users to first login to application and after successful loging, Dashboard appears where i have Buttons. Clicking on button i am displaying Tableview in one Tab bar and in another Tabbar Add to list form.
Thanks in advance,
Sam
What I can get from your post is that you want to have the user log in before the Tab Bar appears with your views.
If that's the case, then you want to set your login view as the main view of the window, and then after they log in set the view to be the view of the Tab Bar.

view controllers in the iPhone SDK

I'm reading a book called Beginning iPhone 3 Developement - Exploring the iPhone SDK, by Dave Mark and Jeff LaMarche. I've read about navigation controllers and multiview applications, and now I want to create my own little app, a very simple Twitter app. I want a login view, and if the login is successful I want the user to be presented a view with a tab bar, where each tab is Update, Timeline and such. Right now I'm just going for the update view.
So I thought about a navigation-based app. The first view, the login view, is on the bottom of the stack. When the user logs in, the view with the tab bar is pushed on to the stack. Then the user does whatever (s)he wants there, in the tabs. (S)he should then be able to press some kind of logout button, which pops the tab bar view off the stack, and takes the user back to the login view.
Now to my question (sorry for my long explanation): is this the way to go? If so, how do I do it? Do I create a view controller called LoginViewController, which is subclassing UINavigationController, or what?
From a UI perspective, a more fluid design might use a modal view controller.
A modal view controller pops up from the bottom of the screen and displays its own view. When this view is dismissed, it shuffles down and disappears.
In my opinion, a modal controller is a good place for a transient authentication screen — you just bring it in view, the user enters his or her info, and the view is dismissed.
On returning to the parent view controller, it checks the authentication credentials and modifies its view if authenticated (or not).
Another advantage of the modal view controller is that it is on its own navigation stack. So you don't need to push a controller, pop up and then push a different view controller. It makes for cleaner code and a cleaner interface (again, in my opinion).