I am unable to add tabbarcontroller in my existing view in my app. I dont want a tab bar application but tabbar in oneof my view in application.Can someone please Help me
To show a view that has got a tab bar in it, you don't need to have a tab bar base application.
Simply create a UITabBarController and then add its view to your main view (as a subview or how ever it is ok for you). You can create the UITabBarController either in IB or programmatically.
Related
I have an iOS app written in Swift with UITabBarController with 5 UIViewControllers. Now, I have a bunch of UIViewControllers that are not part of the UITabBarController. I'd like to be able to show that same tabbar but I have no idea how to do that. Any clue?
More details: This is one of the View Controllers that the tabbar has. I use storyboard references and split my view controllers into separate more manageable storyboards.
So, the big picture:
There's no initial ViewController since I use storyboardId to get to the initial Navigation Controller. From there we have a ViewController embedded in the same Navigation controller. In that ViewController, there are 2 Container views - one of the size of the bottom ViewController that contains the "hamburger" button that toggles the other Container View which has an embedded UITableView in. When a specific cell is selected it should go to Profile ViewController that's not even in the same storyboard. The segue is set to be Push. Either way, doesn't show the UITabBar on the Profile ViewController
how you doing?
I don't know if I understood, but you are trying to show tabbar after going to another screen, right? If the answer is 'yes', try to change your segue to show(e.g. push).
-----Edit-----
You can do with two ways:
Presenting Modally -> using Current Context
Use push(e.g.) with a navigation view controller, you can also hide the navigation bar if you go to Navigation controller -> Attributes inspector -> Navigation Controller -> Uncheck Shows Navigation Bar
Hope now it works!
Best regards
In My Application using UINavigationcontroller and UITabbarcontroller Dynamically and adding views like
UINavigationController inside of UITabBarController issues
in this way . I am able to got both UITabbarController and UINavigationController. Both are works fine. But My issue is Here View Not displaying complete as show in XIB. For example i added a UIButton in XIB at the point (110,380). It wont display in IOS Device.
The Above image is My XIB here Button Below is not displaying in IOSDevice
Please any one help in this issue.
Thanks in advance.
Go to for Nib File , On right side in utility view go to attribute inspector.
Now Set Top bar : Navigation Bar
Bottom Bar : tab Bar
And then design your view .
In Interface Builder try to set bottom bar to Tab Bar.
How would I set a UITabBarController with all its individual view controllers as the root view in a split view? IB doesn't seem to let me change the class of the root view controller to anything else…I'm using Xcode 4.
Are you using the split-view based application-option? In that case, it worked for me to just extend : UITabBarController in the RootViewController.h-file. I'm not sure what behaviour you want here, but if you set it up like that, you should get the tabbar with all your views (you have to add them in RootViewController.m ofc) in the "root"-option on the navigation bar.
If you want the DetailView to show the same, you have to add a navigationcontroller to the detailview as well.
As for the "more elegant" solution with IB, I'm afraid I'm not very fond of or very experienced with IB.
You want to add tabbarcontroller to your split view at rootview side and its very simple.
create as many viewcontrollers subclasses with xib for ipad as u want to put in tabbarcontroller.
Then expand your splitview , u have two things navigationcontroller(which in turns contain rootview controller),detailview controller(right side view).
Open your library just drag tabbar controller exectly onto navigationcontroller ,so it will replace all that navigation controller and rootviewcontroller(i assume u dont need that rootview controller or u can create it later).
now expand this tabbar controller u can see viewcontroller 1 - viewcontroller 2 etc.
Now simply select view controller 1 , open attributes and select nib file on [command 1 attribute] and select controller file for that nib file by press[command 4 attribute].
Reapet this for view controller 2 in tabbarcontroller and save close IB.
run program select landscape then u can see its done.
Thanks to dh14-sl and lecou—the solution was a combination of both your answers. I was trying to drag a tab bar controller from the library onto the list of elements but it wasn't working—turns out I had to drag it to the view itself. Then I had to change the parent class of my rootvc and re-setup connections, but now it seems to work! Thanks guys!
Wonder if anyone can help me with this problem. I have created a Window based application. I have then added a Navigation Controller to the Window (via Interface builder) and subclassesd UITableViewController and used the table delegates in this class to draw my root view table. This all works fine.
I am now trying to add a tab bar to the view. I have done this by dragging a UITabbar in Interface Builder onto the Main Window.
The problem is that when I launch the app, it looks like the table is now being drawn over the top of the UITabbar which therefore makes the UITabbar unaccessible.
Can anyone help me ?
Thanks in advance,
Martin
Have a look at View Controller Programming Guide for iOS : Tab Bar Controllers
If you want to add a tab bar to your application, it should be the main navigation base of your application. Navigation Controller can be part of each tab.
Create a tabBarController. Create navigation Controllers with appropriate View Controllers as its Root View Controller, add the Navigation Controllers into one array, set it to the viewControllers aray of tabBarController object and add the tabBarController.view to your window.
Have a look at this thread, both coding & IB approach has been explained here.
The better and easier approach would be to create UITabbar based application with navigation and add UITableView into that.
A typical Navigation-based app would have its MainWindow.xib contain a 'Window' and 'UINavigationController' -- this seems to work when a NavBar is your root view. If I want to show a NavBar view on launch based on one criteria and a TabBar otherwise, what's a good way to do this, utilizing Interface Builder for some of the layout of my views?
Workflow:
Default.png (Spash) -> NavBar with table or
Default.png (Spash) -> TabBar + NavBar with table
Are there any tutorials that would show some of this?
You could just add both the UINavigationController and a UITabBarController to the app delegate. In your appDidFinishLaunching just have the logic to decide which view to show and only add the correct view to the window.
In IB, you open your MainWindow.xib and you should have a Window and a Navigation Controller already. Add a TabBarController there also, then link it up to the instance variable in the app delegate.
At any time, your app delegate can add either of these views ad subViews to the main Window.