Joyal Clifford Joyal Clifford - 9 months ago 76
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.


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