How to add TabBarItem to default TabBarController without setting it as ViewController - iphone

I'm not using a custom TabBarContoller. Instead of this, i created a TabBarController on storyboard and add my ViewControllers from there. However i need to bind a TabBarItem with UIImagePicker just like clicking button to open UIImagePicker, so there is no need to add another empty ViewController i guess..
I'm not able to drag and drop a new TabBarItem it to TabBarController. Is there a way to do this without implementing a custom TabBarController ?

No, you can't do that -- the tab bar items come from the content controllers, not directly from the tab bar controller. You'll have to add a separate controller, from which you can launch the image picker in its viewDidAppear method, so it will show up as soon as you switch to that tab.

Related

Show UITabBar on UIViewControllers that are not part of the UITabBar?

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

Tab Bar mysteriously disappears?

Attached are two images. The first shows my current main.storyboard, and the second shows my problem when I run the app. I have a tab bar controller that has two tabs. On the first tab there is a button. When pressed, the button goes to another view controller with content. At the top is a Navigation bar with a back button. After viewing content, I press the back button, and am back on the original page with the button, but the tab bar is missing. I have seen a few answered questions, but it appears they made their tab bar in the view controller instead of the storyboard. Another says that I should never return to a previous view unless I use an unwind segue. Is this true? If so, how do I set up an unwind segue. If not, how do I fix this problem otherwise? Thank you.
http://i.stack.imgur.com/IYmX2.png
http://i.stack.imgur.com/7slt5.png
The problem is in the wiring of your ViewControllers. You have probably embedded your UITabBarController inside the UINavigationController and not the other way around.
A correct layout looks like this in Interface Builder :
To reproduce:
In Interface Builder drop a UITabBarController. This will come with 2 UIViewController's already wired in.
Pick one of the UIViewController's (let's call it VController1) and click on Editor / Embed in / Navigation Controller. This wires the VController1 to live inside a UINavigationController that is inside the UITabBarController
Add a 3rd UIViewController next to VController1 Let's call it VController3
Wire in a segue between VController1 and VController3, for example with a button.
I hope that's clear enough
Try Linking the button in your viewcontroller (other than the views of the tabbed bar controller) with the tabbed bar controller. Create a segue that links the button with the controller of the tabbed bar application

Make header view unchanged when switch to another tab

I have a UITabBarController. Now I want to add a view above it, and make the view unchanged when users switch to another tab. I've tried to create a UIViewController, and add the UITabBarController as a subview, but it crashed when I switched to another tab.
Is there any good way to do it? Thanks for any help.
Sure there is. What you'll want to do is make a view controller, which will house the view that is constantly visible, and add the tab bar controller on top of it. If you're using storyboards, this can be accomplished easily using a container view. Simply drag and drop a container from the object library onto the view controller you created, size it as you wish, and link its viewDidLoad segue to embed on the tab bar controller.
http://dl.dropbox.com/u/91385349/tabInView.zip

iPhone - Tweak the UINavigationController to show a UINavigationBar made into IB

I've build a UINavigationBar into Interface Builder, and I have a NavigationController into my app. I'd like to make the one use the other to work. Just to manage the bar into IB and let the controller use it as its view (and adding by itself the Back button if needed), or in another way to do the same thing, let the NavBar use the navcontroller to adjust its display.
Do you see a way to do this ?
If not, I really don't see the use of the NavigationBar proposed into IB.
If you create the view controller in IB, you can give it a navigation item (UINavigationItem), and put your buttons in there. If you only create the view in IB and the controller is the owner (you use initWithNibName:bundle:), then you will either have to create the items programatically or put a outlet named navigationItem in your custom controller and connect it to a navigation item in the nib.

Split view controller menu in w/o split view controller?

I am making an iPad app, and am wondering it is possible to get the pop down menu from a UINavigationBar without having to go through the trouble of a split view controller. Is this possible? Tell me if I'm not being specific enough.
Yes, you can do that without much trouble, but you just have to write the code. Just display a UIPopoverController from that UIBarButtonItem on your navBar.
The steps:
Create a UIViewController which manages a table view (or whatever else you want) as your menu view controller.
Add a UIBarButtonItem to your nav bar or toolbar.
Create an IBAction to called something like touchedMenuButton.
Connect that action to that UIBarButtonItem.
In that method, alloc/init that view controller.
alloc/init a UIPopoverController with that view controller.
present that popover from the UIBarButton item
Success!