Tab Bar Controller - Show a view controller that is not one of the tabs - ios

I wonder if this is possible. The design for this app I am working on is as below:
Two sliding views sit one on top of the other. The bottom view is a 'Settings' view. The top view is a tab bar view. We are using ECSlidingViewController for the sliding.
When the app is opened for the first time, the tab bar view shows with first tab selected.
When they tap on the hamburger menu or slide right, the bottom, settings view slides into view.
When they tap on an item in the settings view, like the About item, the corresponding view should be displayed inside the top tab bar view with none of the tabs shown as selected.
I think I am going to have to convince my team to not display the settings items inside of the tab bar, it seems just too twisted. But just wanted to know if anyone else has done anything like this and if it is possible to do it without introducing too much complication in the code.

I've done something with the same design with a menu that slides from the left and over the tab bars. I ended up putting a View Controller on top of everything else
Something like
[self presentViewController:AboutViewController Animated:YES];
Just make sure that you either put that view controller in a UINavigationController or something with a dismissViewController for users to return to your main page.

Related

Remove default slide right animation on UITabBarController from "More" Menu

I have a situation where I have enough tabs on a tab bar controller where the default system functionality has introduced the famous "..." more icon.
This is totally fine and I'm happy with the menu that is popped up when you tap it.
What I've noticed however is that a default transition occurs when selecting a item from the "more" menu (basically a slide right) to load the VC from the menu. Unfortunately this also introduces a lag on the accompanying slide "left" to get back to the menu.
My question is if this is default behaviour I have to live with or if this is something I can remove completely (ideally no transitions would be my preference).
Thanks,
Andrew
May this help you:
The More Navigation Controller
The tab bar has limited space for displaying your custom items. If you add six or more custom view controllers to a tab bar controller, the tab bar controller displays only the first four items plus the standard More item on the tab bar. Tapping the More item brings up a standard interface for selecting the remaining items.
Solution to your query:
Add only Five view controllers in your tabbar controller.
For last Fifth view controller, add more tabbar button icon (or any other image icon) manually and set a similar looking tableview (menu list).
Handle further navigation for remaining (Sixth onwards) view controllers, manually from tableview (row selection)
Storyboard Layout:
If you are looking for an alternate of more navigation, then you must customize tabbar controller and this may help you:
ZRScrollableTabBar: Scrollable tabbar items
IDScrollableTabBar: changing tabs with left and right swipe gestures on the tab bar.
JFATabBarController: Swipe tabs left and right
Ask me, if you want more clarification here.

Xcode 6 - Swift - Custom Tabbar with Navigation

I'm trying to create a tabbed application with navigation elements inside the tab bar, as seen in the picture below (the red bar) using Swift/XCode 6.2. Basically those three icons in the middle will direct the user to different view controllers. The other two icons would be context-based. For example, on a table view page you would see the menu icon and add new icon as seen in the image. However, clicking on a row would change the menu icon to a back icon, and the add icon to something else.
That's the general idea, but I'm having a very hard time implementing something even close to this. The first issue is that whenever I embed a view in a Tab Bar Controller, I can't move the tab bar to the top. However, when I create a custom UITabView in a View Controller, Control + Click and dragging a Tab Bar Item to another view doesn't create a segue. I haven't even begun to tackle having the navigation elements inside the bar.
I guess what I'm asking is just for a little guidance on what route to take to tackle this. I'm assuming I can't use a Tab Bar Controller or Navigation Controller because it doesn't seem like I can customize them all that much. So custom Tab Bar and Navigation Bars, and then implemnt the segues and button changes programmatically?
Thanks.
I will try to guide you from an architectural perspective (so you won't find much code below).
Using a UITabBarController
In order to achieve what you are suggesting, you are right you cannot use a UITabBarController straight away, among several reasons, the most immediate one is that they are meant to be always at the bottom and you want it in top (check Apple's docs). The good news is that probably you don't need it!
Note: If you still want to go with a UITabBarController for whatever reason, please see #Matt's answer.
Using a UINavigationController
You can use a UINavigationController to solve this task, since the UINavigationBar of a UINavigationController can be customized. There are multiple ways on how you can organize your view's hierarchy to achieve what you propose, but let me elaborate one option:
To customize a UINavigationBar's to add buttons, you just need to set its navigationItem's title view:
// Assuming viewWithTopButtons is a view containing the 3 top buttons
self.navigationItem.titleView = viewWithTopButtons
To add the burger menu functionality on a UINavigationController you can find several posts on how to do it and infinite frameworks you can use. Check this other SO Question for a more detailed answer (e.g. MMDrawerController, ECSlidingViewController to mention a couple).
About organizing your view hierarchy, it really depends on if when the user taps one of the main top buttons, it will always go to the first view controller in the new section or if you want to bring him back to the last view in the section where he was.
3.1 Switching sections displays the first view of the new section
Your app's UIWindow will have a single UINavigationController on top of the hierarchy. Then each of the 3 top buttons, when tapped, will change the root view controller of the UINavigationController.
Then, when the user changes section, the current navigation hierarchy is discarded by setting the new section view controller as the UINavigationController root view controller.
self.navigationController = [sectionFirstViewController]
3.2 Switching sections displays the last displayed view in the new section
This will require a slightly modified version of the above, where your each of your sections will have its own UINavigationController, so you can always keep a navigation hierarchy per section.
Then, when the user taps one of the top buttons to switch section, instead of changing as previously described, you will change the UIWindowroot view controller to the new section's UINavigationController.
window.rootViewController = sectionNavigationController
Using a custom implementation
Of course, the last and also very valid option would be that you implement yourself your own component to achieve your requirements. This is probably the option requiring the biggest effort in exchange of the highest customizability.
Choosing this option is definitely not recommend to less experienced developers.
I'd like to take a stab at this--I think it is possible to use a tab bar controller here.
Your topmost-level view controller will be a UITabBarController with a hidden UITabBar.
Each tab is contained in a UINavigationController.
All view controllers in the navigation controller will be a subclass of a view controller (say, SwitchableViewController).
In SwitchableViewController's viewDidLoad, you set the navigation item's title view (i.e. whatever's at the center; self.navigationItem.titleView) to be the view that holds the three center buttons. Could be a UISegmentedControl, or a custom view.
Whenever you tap on any of the buttons, you change the topmost UITabBarController's selected index to the view controller you want to show.
Issues you may encounter:
Table views inside tabs will have a scrollIndicatorOffset at the bottom even if the tab bar is hidden.
Solution: Play around with the automaticallyAdjustsScrollViewInsets of the tab bar controller, or the inner view controller. https://stackoverflow.com/a/29264073/855680
Your title view will be animated every time you push a new view controller in the navigation stack.
Solution: Take a look at creating a custom transition animation for the UINavigationController.

iOS: TabController not showing with Navigation Controller

I have an app with the start screen consisting of a table menu main which links to 4 different views, then three options to information pages.
Once on any of the main menu options are chosen, the view is shown with TabBar at the bottom of the main menu options. While the nav bar at the top has a back button leading to the main menu.
I built the storyboard which goes from a table view select to a single page. After that was working and passing data, I embedded the single view into a Tab Bar Controller and added a second page. It seems to be working as I would expect however the Tab Bar is not visible on the screen.
Can please anyone help?
I have added an image of the storyboard below:
Get rid of the navigation controller. There is no deed for it so far. Make the tab bar controller your root view.
If you need a navigation conroller within a certrain tab, or some or all of them, then add navigation controllers to those tabs (to the right in your storyboard).

Slide viewController in navigation controller

I'd like to use a slide up / down effect to display various viewControllers inside a navigation controller. A few other apps do this like square, and every day. Basically when the app loads, I want to display a base view in the navigation controller. Then slide up another view controller over top of it. When then hit a button in the nav bar, I want to slide that down and show the base controller, all the while retaining the navigation bar, and changing up nav items.
Originally I tried to make this work by showing a modal but that requires using a new nav bar.
Has anyone done this, or knows of a good example that illustrates this UI pattern? Thank you!
You could have UIViews in a UIScrollView

"Slide" segue between UITabBar views

My iOS 5 app uses storyboarding with a UITabBarController. There are three "tabs" each displaying a view controller which has been linked using a relationship back to the UITabBarController. At the moment each view controller appears when you tap the relevant tab, as expected. However, for a more gracious transition I would like to slide the view controllers on and off screen.
By way of example, if I am currently on Tab 0 and then select Tab 1 the view controller on screen (for Tab 0) should slide off to the left-hand side of the screen, and the new view controller (for Tab 1) should slide on from the right-hand side of the screen.
I have been able to achieve this behaviour using a custom UIView as the tab bar but would like to know whether this is possible with a custom segue in storyboarding, as that would certainly save a lot of coding (and also would keep things a fair bit neater in the project)?
Thanks in advance for any assistance.
I am trying to do the same thing.
Unfortunately I think the relationship segue does not allow any customization as it just connect tab bar and the tab bar items together, and not a transition.
My guess is we have to do the transition ourselves when the view appeared.

Resources