How to change inputView of UISearchBar in iOS7?
问题 In iOS6 , I use the below code to change inputView of UISearchbar for (UIView *view in _searchBar.subviews) { if ([view isKindOfClass: [UITextField class]]) { UITextField* textField = (UITextField*)view; [textField setInputView:_myKeyboard]; break; } } UISearchbar in iOS7 had changed, I don't know how to find textField to change inputView. Please help! Thanks! 回答1: The hierarchy of subview has been changed in iOS7, so you can use the following code: // subviews NSArray *searchBarSubViews = [