Joyal Clifford Joyal Clifford - 1 year ago 132
Objective-C Question

Display datepicker when tapping on UISearchController (Searchbar)

I am using

programmatically, While tapping on
I want to be set Date picker as inputView

@property (strong, nonatomic) UISearchController *searchController;

References for text field : iPhone display date picker on UITextField touch

But unable to able to access Search bar Textfield. Please help.

Answer Source

You can get search textField using following code. Write it in viewDidLoad

UITextField *searchBarTextField = [self.searchController.searchBar valueForKey:@"_searchField"];
[searchBarTextField setInputView:datePicker];

Hope this will help you

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download