SplitviewController in navigationviewcontroller - ios

Hey I am building my first ios application using xcode. I'm a total noob in xcode and swift and I am trying to use the storyboards to set-up my app. Here's a link to the prototype http://adobe.ly/1q5Imf6.
Basically my issue is where I want to do the split view on the resellers page. I want to use the splitviewcontroller only on the page, so after an intro viewcontroller in a navigation controller. like this
I read somewhere that a splitviewcontroller must be the initial view controller, however this works if I use segues that pop up modally. But when I do that I don't really have a navigation bar anymore on the page. I only have the splitview, but there must be the option to go back.
Am I doing this completely wrong or is there a simple fix to get what I want?

If you want to present your UISplitViewController modally, then you need to wrap into UINavigationController. After it you can add UIBarButtonItem in your UISplitViewController and set an action to dismissViewControllerAnimated(true, completion: nil)

Related

How to switch between different ViewControllers or NavigationController in Swift?

I just got into Swift programming lately and I have an easy question I can't answer.
I understood that we start putting a ViewController to show something, then if I want to display another view I can use a segue linked to another view. But I don't like the fact that the view called by the segue doesn't take the full screen. It just looks like a pop-up screen.
So, how could I switch from a ViewController to another ViewController or NavigationController or whatever that keep the fullscreen view.
How could I change my view without passing through a segue and get the following view like a pop-up ?
Hope my wonder is clear enough to be answered :D
Thanks a lot to the community !!!
You can make your segue's presentation style as fullscreen. But if you want to use UINavigationController, first you need to embed your ViewController in UINavigationController(rootViewController: ViewController()). After that you can navigate to another ViewController using pushViewController method.
When you use UINavigationController, it will stack on top of each other. When you use popViewController, the current ViewController will be popped off from the stack. That's how works in general.

xcode view became modal when connected as segue

I'm pretty new to Swift/xCode and now I'm stuck with a very (for me) strange behaviour. When I connect a button inside a view to perform a segue, the target view became modal.. what I'm doing wrong?
Please take a look to below gif that show the problem and my setup
LoginViewController should be managed by a NavigationController to make it work. If you try to show some view controller without having a NavigationController in the navigation flow, it will appear as a modal. So embed LoginViewController as the RootViewController of a NavigationViewController

Navigation Controller Header is not showing

So, here I basically have this layout
but when I build successfully I am not able to see the title of the navigation controller.
What can I do?
This is what you want to emulate:
Set the UITabBarController as is Initial View Controller
add a relationship to each scene, whether it is a UINavigationController or not
If a scene is a UINavigationController, it will behave like any root navigation controller, with its own view stack, back button, an so forth.
Running the app above, then tapping on Item 2 will present this navigation controller:
If you cannot make the UITabBarController the initial View Controller at launch, you can make it become root later on using this technique:
let newViewController = self.storyboard?.instantiateViewControllerWithIdentifier("id")
as? UIViewController
self.view.window?.rootViewController = newViewController
This will present the architecture above, albeit without animation (nor any way to navigate back). Perfect for onboarding or login screens.
Tested on Xcode 7+, iOS 9+
Make your TabBar Controller the initial view, And make sure to remove the navigation controller that's linked to it, Then it should work fine.

Display extra view controller without removing the tab bar

My app has a menu and a UITabBarController. What I want to do is to display a view controller that belongs to my menu but not to the UITabBarController, However I don't want to remove the UITabBarController. I tried codes similar to the one below but they are removing the UITabBarController.
tabBarViewController.selectedViewController?.presentViewController(ExtraViewController, animated: true, completion: nil)
You should get UINavigationController of selected ViewController and then push view you want to present. Otherwise you are presenting modal view controller with presentViewController witch hides your UITabBarController view.
Im not at my computer right now, and cant post any code, but hope this helps.
Best way to do it is to use UINavigationController. You can create new one programmatically and put your menu controller as root.
And if you put this UINavigationController as one of views in UITabBarController then you can preform a code like:
[self.navigationController pushViewController:ExtraViewController animated:NO];
Also you can use storyboard to create your controllers hierarchy like that:
To do that select your menu controller and go to Xcode menu>Editor>Embed in>Navigation Controller and then Xcode menu>Editor>Embed in>Tab Bar Controller.

TabBarController in NavigationController does not show TabBar in viewControllers

I have a UITabBarController to whose controllers I would like to attach navigation. So I inserted the NavigationController as the entry controller, and the tabBarController as its root. All seems working fine, but for the tabBar. Basically it does not show, albeit the StoryBoard I attach seems to say differently. I also attach the Account Screen not showing any navigation bar nor, of course, any back button.
Thanks,
Fabrizio
Just a quick answer. I think you should put UINavigationController inside the TabBarController instead of the other way round. It will solve most of your problems.
Steps: Editor -> Embed in -> Navigation Controller
See the below screen shot on how to add a Navigation Controller to a View Controller.
You are following wrong approach, IOS does not allow you to use tabbarview controller as root of navigation controller, it always display black screen. I have faced same problem and as a solution i have added navigation bar after tabbar controller. Yes it becomes difficult to manage, but you can use that way and it will work.
If you use programmatic approach instead of storyboard then it is possible, see this link
Even you can try from Editor option of XCODE, select tabbar controller you have added from storyboad then go to Editor->Embedded in, you will see that navigation bar controller is disable.
This is also give you idea that it will not work.

Resources