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
?
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.
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.
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.
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:
you can add like this,
[self.navigationController.navigationBar.topItem setTitleView:pickerView];
Hope it will helps you.....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With