How to add a toolbar to a UIPickerView subclass? - objective-c

I've created a UIPickerView subclass, I've completed the implementation of the picker view itself.
What I would like to do however is to add a toolbar above the picker view as part of the new class. How and where should I do this in the subclass implementation?

I would add both the picker and the toolbar to another view and use that as your "control"

Related

ios rightBarButtonItem

I have a UITabBarController which is the second item inside a UINavigationController.
Each item within the UITabBarController is a sub class of UIViewController. How can I create a button that appears at the top right of the navigationBar and changes depending on which tab is selected.
I am using storyboards, just in case there is a gui way of achieving this.
Implement the UITabBarControllerDelegate method tabBarController:didSelectViewController: and then depending on what view controller was selected set the rightBarButtonItem of your UINavigationController to show whatever you want it to show.

ios UIview in views

I have a uiview that has all my buttons, that has its controller. How can I include the button view in all my uiviews using the interface builder? The buttons must work when click. The purpose is to increase maintainability.
You can create a custom UIView in interface builder like this:
Loading custom UIView from nib, all subviews contained in nib are nil?
Then add your custom view to other views in IB by adding a normal UIView and changing the class to your subclass.
Try this. I'm not sure that adding UIView in Interface Builder will work, but adding subview programmatically always works.

Create a UIViewController that contain a UIViewController

I have a UIViewController that allow me to display some text into a view.
I want to add an input method without add it directly into this view controller, this input method will be a button or a UITextField.
This input method will be a lot, but it will be use one at time chosing it from setting so a I won't to have a UIViewController that control all of this.
What I want is know how it's possible to split the output view (controller) with each input view (controller)?
You can image to have a text view on the top of the screen and some other view at the bottom and I will to separate the logic of the second view from the logic of the first one
Is it clear?
Of course it is possible to have 2 UIViewControllers on screen at any time! There are a few ways to go about this:
Using One Main View: Add the second ViewController's view as a subview
Using Interface Builder: Drag in a UIViewController Object, set it's class, then hook it's View outlet to a UIView in the first ViewController.
Child View Controller: As it's name implies, the -addChildViewViewController: method will add a new ViewController as well, then add it's view as a subview.
Yes, it's possible. Just add the controller as a child controller ([UIViewController addChildController:] and its view ([controller.view addSubview:childController.view]).

Changing rootviews view type in an iOS app

While creating a navigation based application, it automatically creates a root view controller which subclasses UITableViewController, but in MainWindow.xib as you know I can't see a UITableView is placed under root view controller but we drag and drop a table view there. Can we simply drag and drop a UIView instead of a UITableView and change the root view controller class to sublass a uiview instead of UITableView and change its methods?
Or I must drag a UITableView in IB for the root view controller? I am a beginner and I do not want to make complicated things so what is the simplest way of using a UIView as a root. If thats not simple I will stick with the table view.
Yes you can change. You just need to change some bindings in inteface builder and change rootViewController's superclass to UIViewController instead of UITableViewController.
UPDATE
First open the rootViewController.xib and delete the tableiew from there and drag-n-drop a UIView. Bind that View to view property in file-owner. Change superclass of rootViewController from UITableViewController to UIViewController. That's it.
Here are the screenshots.

UIView controller containing toolbar and UITabBarController

I'm currently creating an ipad application.
the idea is to have a toolbar at the top and a tabbar at the bottom.
The toolbar has to be visible on all tabs, so it won't disappear.
I was thinking about having a UIViewController as the main view and put the tool bar in there.
Then adding the uitabbarcontroller to that main view controller, but i'm not sure how to do that.
At the moment i have my tabbarcontroller as the main view and added the toolbar to every tab.
Can anyone help?
Thanks
The Tab Bar Controller should be at the root. What you can do is create a method that returns a propertly configured toolbar & add it to each of the view controller's viewDidLoad (either by using a category method, inheriting a common UIViewController subclass, or simply via a C-style factory method.
This way your hierarchy isn't flipped, and the tab bar is at the root like it should be.