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

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!

Related

Changing tabs on Tab Based Application Pushes UI Elements Down

I have a tabbed based iOS application. The fourth tab is linked to a UINavigationController. When I navigate to the home tab from the fourth tab, the UI elements of the home tab are pushed down. However, if I rotate the phone to landscape and then back to portrait, everything has moved up and is in the correct place.
In Storyboard, I set the top bar to none. I have the UINavigationBar hidden in the fourth tab/view controller before I navigate to the home tab.
Why would it be that the rotation fixes the constraints? How can I fix the UI elements such that they are not pushed down in the first place?
Here is a screen shot of my storyboard:
Your question doesn't really make sense. A 4th tab would not be embedded in a navigation controller. Instead, the 4th tab would link to a navigation controller. When you first select that tab you'd see the root view controller and it's navigation bar item. If you pushed a new view controller it would get pushed onto the navigation controller in tab 4. If you switch to one of the other tabs then the navigation controller will be swapped away and it's navigation bar will no longer be visible. Swap back to tab 4 you'll see it again, complete with it's navigation bar.
I created a sample app in order to confirm what I'm describing, as I haven't used tab bar controllers a lot, and not in quite a while I can upload the project if you really need to see it. It only contains a couple of lines of code (to implement the button on the navigation controller's view controller that creates and pushes a new view controller.)

How can I implement tab bar controller, navigation controller and table view controller?

I'm looking to create an application with 4 screens. The first screen will have a tab bar controller with two tabs. The second tab will go to 3rd screen. The 3rd screen will be a table view and when a cell is clicked, will push to the 4th screen and then I want to have a back button on 4th screen to navigate back to 3rd screen. The first screen will have a button that segues to the second screen and from the second screen there is a button that segues to 3rd screen which is the table view. The second screen should also have a back button to go back to first screen. How can I implement this via StoryBoard?
There are a lot of tutorials in the Apple developer site... but also on youtube... search for "Storyboard ios" you can find a step by step tutorial on how to manage the tableview controller and additional tableview to show details. I suggest also to look at http://www.raywenderlich.com/
What I understand so far from your question. You should first drag a Tab bar controller, that will by default have 2 tabs. Now on 1st tab or 1st view controller, place a button and make its push relation with the view controller you want. 2nd tab will open 3rd screen. Place a table view in it(view controller with 2nd tab or item). Make push relation from table view cell to the 4th screen(drag view controller and embed this view with navigation Controller). Embed all those views with navigation controller form where you want to turn back to previous view controller. Hope this is what you wanted.
I have figured out my issue. I wasn't using push to segue with my navigation controller and that was throwing everything off. Thanks for the help!

IOS using different navigation bars

I'm creating an application where I need to use two different navigation bars. When the application first opens up, the nav1 bar should be displayed with an image and a Login button .. when they login screen appears, there is no nav bar. After login, it goes to a Detail screen where I need to show a back arrow image, a screen title and a menu button with drop down options.
I'm using one View_Controller that all my Views inherit from. I've been working on this for days and I'm so lost, please help.
I'm a little confused about the structure of your app.
As I understand it, you want an initial view that is contained in a UINavigationController. Once someone taps the "Login" UIBarButtonItem on the UINavigationBar, then you have a view come up that is not contained in a UINavigationController (probably because it is a modal view that is outside the navigation flow of your app).
The part I'm confused about is where the Detail view comes in. Is the modally presented view dismissed while the Details view is pushed onto the navigation stack from the initial view? Why does the Details view need a back button? Does going back to the initial view effectively log out the user?
At any rate, you should be able to change the UINavigationBar for every view that is pushed on to the stack (that is also contained in your UINavigationController). If you are using Storyboard, you need to make sure that you embed the views pushed on to the stack in a UINavigationController. You can do that by going to the "Editor" menu, selecting "Embed in" and then selecting "Navigation Controller".
Let me know if I didn't understand your question or if you can post more details.
Navigation bar will be the same in the app. You can hide it, show it, change title, change background color, or background image on each view depending on your requirements. But there is only one navigation bar in navigation based apps.

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.

STACKING OF TABS similar to iPad Chrome app

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.

Resources