2

How to implement: I have UIBarButtonItem with search icon, after click on it, I want to show search bar in navigation bar and on click cancel button in search bar, I want to show navigation bar without search and with buttons and title like in IOS 7 calendar app.

Vitaliy
  • 45
  • 1
  • 7

1 Answers1

1

from apple documentation:

In iOS 7, UISearchDisplayController includes the displaysSearchBarInNavigationBar property, which you can use to put a search bar in a navigation bar, similar to the one in Calendar on iPhone:

https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/Bars.html

ManicMonkOnMac
  • 1,476
  • 13
  • 21
  • 1
    Yes, but how to use this property correct? When I set it in **viewDidLoad** it appear on start in navigation bar, but I need to show it on **UIBarButtonItem** tap and hide on **Cancel** tap. – Vitaliy Oct 30 '13 at 17:25
  • after you set this property the navigation controller will use the navigation items from searchDisplayController, you can modify them as per your need when you wanna show and hide the search bar. – ManicMonkOnMac Oct 31 '13 at 14:46