STACKING OF TABS similar to iPad Chrome app - ios

I need to develop tab bar similar to Chrome's tab bar functionality on iPad. If the user opens more then 5 tabs it displays the extra tabs as a stack:
stacked tabs http://uploads.hipchat.com/26718/169836/yfzwdgq80m4rzbw/Screen%20Shot%202013-04-10%20at%202.36.56%20PM.png
How can I achieve this?

There's nothing like that built into iOS, so you're going to have to implement it yourself. I'd suggest implementing the tab bar portion of the window as a separate view that knows how to draw the individual tabs, including the currently selected tab, and which sends an appropriate message to it's target or delegate object when one of the tabs is tapped.

You can build a UINavigationController like Controller, with its own stack. If you are targeting iOS 5.0 and above you can use childViewController. The controller will have a tab bar, and container view. You will add view controllers to the stack of the Controller. From the stack you can form the tab bar item View, using titles of respective vc and views can overlap.
When they are selected bring the tab bar item view to the front and add the respective viewController as childViewController to the CustomTabBarController.

Related

Custom/common toolbar in Swift

I'm quite new to Swift and am working on an app where I'm not sure how to setup the navigation. It works with a tab bar, except that I want the bar to display nomatter what view is being displayed. There are 4 "main" views that the user should always be able to get to. The problem comes when I get into subviews of one of those main views.
I have the tab bar with the 4 icons for the primary views. It's currently displaying the "activity list". When the user clicks on an activity, it will display a list at the next level of detail. However, that view is not one of the primary ones that is represented in the tab bar, so it has no tab bar and no way to transition directly to one of the primary views. You have to back your way out to the Activity list before you can select a different tab.
Say that the main views (represented in the tab bar) are A, B, C, and D. I want to be able to display the same toolbar on all sub-views (e.g. C-1, C-2, etc.) and allow direct transition to any of the other main views, without the user having to manually back out of each sub-view.
What is the "best" way to accomplish this?
1) Should I be creating a custom toolbar object that gets implemented on every view controller?
2) Should it be a combination of tab bar and tool bars?
3) If I have drilled into a stack of views, do I need to pop all of those views individually before I can switch to a different tab?
4) What do I use as my "root" view?
Thanks for any suggestions. I have hunted, but haven't found an example of a scenario quite like this.
I think I figured it out. I needed to embed each "tab" view in a navigation controller.
So...
Tab Bar Controller --> Navigation Controller --> View Controller --> "view stack"
The tab bar now remains at the bottom for every view, and if I touch the tab icon a second time, it goes back to the original tab view controller.

iPad show a view not inside Tabbar

I am developing an iPad application.
My application is a UITabBar based application with 5 tabs.
Now my requirement is to show a view controller outside these 5 tabs.
Explanation:
For example I have 5 tabs, A, B, C, D, E.
A is selected by default.
Now I have to show a new view controller say, F. But when I show that view none of the tabbar item should be selected.
What I have tried:
I created a UINavigationController as 6th tab. Now its not visible at the bottom and it nearly produces the effect I needed but have following two problems.
Tab bar items are not center aligned (Due to one hidden tab at right)
User can tab that hidden tab
Update:
Actually I am following an already developed application and I am sure its possible.
Scenario is I have 5 tabs that user can access without login. On navigation bar I have login button. When user is logged in I have a menu button in my navigation bar. Now tapping menu will show a view that doesn't belongs any of the tabs below. And that's why I need implementation explained above.
Work around I used to achieve above effect.
When I need to push my new UIViewController for which I want to deselect all of the UITabBarItem of my tabBarController, first I do the following things
Set selected index of tabBarController to last tab.
Set deselected image in last UITabBarItem
Get navigation controller of last tab and pop it to RootViewController.
Now push my new controller
Hide back navigation button in my view controller.
Hence I am able to show a Viewcontroller keeping user experience as current view is not in any of the tabs.
Thanx.
Sounds like a job for a modal view controller, i.e. one that's displayed in response to some user interaction other than selecting it via the tab bar.

Xcode - How to attach a tab bar to a view without adding a tab for the new view

I have an application which has 5 tabs. I also have another view which you can access from tab3 via a selection of buttons. I will call it view 3b. View 3b populates with information based on which button the user selected in view 3. After the user puts in all the information required the app automatically takes them back to view 3. I want to add the tab bar to this view(3b) but I do not want it to have its own tab. I just want to use it so the user can navigate out of this view back to the rest of the app if they want to exit the screen early. Does anyone know how I can attach the tab bar to this screen without having a tab added for this screen. I am using Xcode 4.6.2 and am using storyboards to set up my app.
Any help would be appreciated. I've done a bit of searching but everything I find just explains how to use tabs.
Any help would be appreciated. Thanks.
It sounds like you need to use a UINavigationController.
When you set up your UITabBarController, instead of linking the third tab directly to your 3rd view controller, connect it to a UINavigationController, and then set the root view of that UINavigationController as the UIViewController you want as your third tab.
From there, you can set up your buttons to perform a push segue to your second view controller (view 3b from your question). If you do this, not only will you keep the tab bar on view 3b, but a back button will automatically be placed in the top left of the page so the user can simply go back to view 3. If you don't want the navigation bar that appears to be there, you can instead uncheck the "shows navigation bar" checkbox in the UINavigationController's attributes inspector.
I hope this helps!

How to go from a single view to a tab bar view

need some help here
My problem is, my app starts with a single view, it shows a menu made with buttons that takes me to different places, one of this places is another kind of menu, but this menu is a tab bar menu, so the thing is, I made a new file with its .xib, I added the tab bar controller, and i Linked all the sections of my tabs with its viewcontrollers...
this means that I have my first menu ready, I have my view controllers ready, I have my menu on the tab bar ready....
so my problem is...
how can I go from my single view (the first view that I see and that doesnt include a tab bar), to the new screen with tab bar controller in it after pressing a button???
help me please
Note: I'm using XCode 4.2 and I'm not working with storyboards (requirements of the app)
You have three options to show your viewController content :
1.using presentModalViewController:
2.add the viewController view as a subView to the current viewController. in your case : [singleViewController.view addSubView:tabBarViewController.view];
3.or if your simple ViewController is the navigation root viewController you can push other viewControllers to its navigation stack. (as #roronoa zorro described).
You might have added all the next viewControllers on the taBarController so if you have want to tabbar on to next screen you simplr have to push the tabbarcontroller on the navigationcontroller.
[self.navigationController pushViewController:TabBarControllerObj];

"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