Adopting a side menu in iOS app. View controllers structure issue - ios

I'm designing an app intended to have the following navigation structure: I need to have a welcome view with "Sign up" and "Sign in" buttons as most of apps have:
This view does not show any navigation bar, as it seems to be the common thing. If "Sign In" tapped, then the login view will be presented modally:
And if "Sign up" tapped, the welcome view navigates to a form requesting user input to create an account:
Then, once the user logs in and enters the app, I'd want it to have side menus similar to Facebook, YouTube or Spotify:
Being the central panel a UINavigationController. Left side panel I think it usually is an 'UIViewController'...
The point is, I donĀ“t know what the rootViewController of my app should be, and what hierarchy of view controllers should I have. I've thought about a couple of possibilities:
1) Being the rootViewController an UINavigationController, push the welcome view hidding the navigation bar (is that possible?), presenting the "Sign In" view if needed or pushing the "Sign Up" view. Once the user has logged in, pop these views from the rootViewController, that is a UINavigationController, and then push in such navigation controller the custom view controller managing the side menu stuff.
2) Being the rootViewController the side menu custom view controller, and setting as its central panel an UINavigationController. Push there the welcome view and so on, without setting any view controller for the left/right panels, and then when user has logged in, pop those views from the central panel's UINavigationController, push there the corresponding view, and now setting the left/right panels
I hope I've explained myself. Maybe there is another and better approach to handle this scenario. Does somebody implemented an app like this? I need help with this issue, and also I'll appreciate being recommended a custom library/control providing the side menu stuff from someone who has used one and it is easy to use and customize. I know there are lots of them (MMDrawerController, JASidePanels, for example), but I'd like to have some opinions from people that had developed an app with one of them.
Note: I need to support iPad as well, and iOS 5+
Thanks a lot

I would recommend you to have two main ViewControllers, one for login/signup and second one for the main content with side menu. After the user will log in, just change the window rootViewController to the second one.
For the side menu you can use:
JTRevealSidebar for iOS
GSSlideMenu
JASidePanels
MMDrawerController

I've design an app using ECSlidingViewController (created by Michael Enriquez) which works very fine for me and easy to use.
Tutorial also available on youtube : http://www.youtube.com/watch?v=tJJMyzdB9uI

As for Swift, you could use InteractiveSideMenu library as Side Menu. It's quite easy to implement and transition animation looks pretty smooth.
It was a good find for my project.

Related

how to handle popUp's next viewController to embed in navigation?

I have a tab bar, an every item of it embedded in navigation controller, and several child viewControllers!
and I have a pop up view which I created in a new viewController!! to show my popUp I had to choose "present modally"!
when I go to a new viewController from my popUp on pressing button, it's not embedded in my navigation controller!
is there any way to fix it?
and the new viewControl also stays embed in navigation to show my tab bar
Unfortunately, what you are trying to achieve is not right, and please do not proceed with your initial plan.
I strongly believe a quick look at this could help you understand better UINavigationController and the difference between push vs present UIViewController in iOS.
As an answer to your question, you can imitate your wanted behaviour, but there is no direct native iOS way to accomplished your goal. Better, use pushViewController:animated: instead of present. More in the apple dev site - here.

How to always show a viewcontroller even when navigating screens in iOS?

I have this music player view controller that can be minimized. Thanks to LNPopupController[https://github.com/LeoNatan/LNPopupController].
Everything is working fine, but I have no idea how to make this music player view controller stays on top even when the user navigates to the other screens (even when the main navigation controller pushes another view controller). The app doesn't use tab bar controller by the way.
So, is there a way to implement this kind of idea? Again, sticking the minimized view controller on top of every screens of the app?
Developer of the framework here.
If you present the popup bar from a navigation controller, it will appear for all pushed controllers. Likewise for a tab bar controller.
If you need to have it for all controllers, it's not easily possible. One way is the have your entire application scene appear as a child controller of a view controller, and have that controller present the popup bar. This is a difficult way to make it work, and not recommended. It has many issues.
The popup controller is not meant to appear on the screen all the time. It is meant to implement a similar functionality as Apple's.
add the minimized view controller on keyWindown which your minimized view controller always on top ,I didnot Know whether can help you,the code demo gif as is show,If anyone need Demo,give me Email:59620one463qq.com(replace one to 1) to get demo

Switching between views in iOS app

I have a slide out menu in my app and each of the things in the menu goes to the respective pages.
Basically, when I tap "graph section" on the dashboard, I want it to go to the graph page without the Dashboard back button.
I've tried doing this with a modal segue but this provides a back button which means I can't access the menu on this page.
Anyone know how to do this?
I am not quite sure whether this answers it but have a look at:
Open View Controller programmatically and not using a Seque
I think you Use navigation controller.Once you hide the navigation controller for that particular page with [self.navigationController setNavigationBarHidden:YES]; and add UIButton and write it's action

Root view controller issue for a common scenario in iOS

I want my iOS app to follow the common pattern of having a main view where signing up or signing in is required to access the app, so if it is the first time the app is run in the device or the user is not logged in, that is the view displayed, and another app view is displayed otherwise. "Sign up" and "Sign in" buttons in main view may navigate to the corresponding forms, or they may show them modally. Once the user access the app, it should be tab based, similarly to Twitter app.
My question is: what should be my rootViewController? A UINavigationController where to push the main view if there are no user's credentials, and the UITabBarController if there are? Or should I set the rootViewController dynamically in the app delegate depending on having credentials or not?
Thanks
I recommend the second solution, use the login screen as root first and on login, change the rootViewController. You can animate this the same way as a modal presentation is animated.
Embedding UITabBarController in a UINavigationController is against the iOS design philosophy. I'm not sure if you'll get a warning or a black screen but something wrong will definitely happen.
There's no need switching between rootViewController.
The rootViewController should be the root, in your case that's the UITabBarController connecting to theUINavigationController or viewControllerwith the signup sign in forms. If the credentials are there, just skip that view.
Switching between roots sounds a bit off. What if the user signs off? what if the user has multiple accounts and signing in and out? That's a lot of unneeded switches.
According to Apple recommendation, UITabBarController should always be the root view controller of your app. more Interesting reading:
When embedding navigation controllers in a tab bar interface, you
should embed only instances of the UINavigationController class, and
not system view controllers that are subclasses of the
UINavigationController class. Although the system provides custom
navigation controllers for selecting contacts, picking images, and
implementing other behaviors, these view controllers are generally
designed to be presented modally. For information about how to use a
specific view controller, see the reference documentation for that
class.
Link

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