Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Add Custom UIPickerView to UINavigationBar?

I need to add custom picker view toUINavigationBar like this. But If I move pickerview to UINavigationBar it appears behind UINavigationBar.How can I display it correctly above the UINavigationBar?

enter image description here

like image 282
Harikrishnan Avatar asked Dec 19 '12 04:12

Harikrishnan


People also ask

How do I change the navigation bar in UIViewController?

Configure the appearance of the navigation bar using the navigationBar property on the UINavigationController object. Control the content of the navigation bar by setting the title and navigationItem properties on each UIViewController you push onto the navigation controller’s stack.

What is a navigation item in uinavigationitem?

Instead, you use a navigation item (an instance of the UINavigationItem class) to specify what buttons or custom views you want displayed. A navigation item has properties for specifying views on the left, right, and center of the navigation bar and for specifying a custom prompt string.

How do I add a subview to a navigation bar?

When you use a navigation bar as a standalone object, you are responsible for providing its content. Unlike other types of views, you do not add subviews to a navigation bar directly. Instead, you use a navigation item (an instance of the UINavigationItem class) to specify what buttons or custom views you want displayed.

How does the uinavigationcontroller work?

The UINavigationController object creates, displays, and manages its associated navigation bar, and uses attributes of the view controllers you add to control the content displayed in the navigation bar. To control a navigation bar when using a navigation controller, the following steps are required:


1 Answers

you can add like this,

[self.navigationController.navigationBar.topItem setTitleView:pickerView];

Hope it will helps you.....

like image 198
Venk Avatar answered Sep 20 '22 14:09

Venk