In my iOS App , i need to set custom inputView
for UISearchBar
in iOS7
.
So i wrote following codes.
NSArray *searchBarSubViews = [[self.sBar.subviews objectAtIndex:0] subviews];
for(int i =0; i<[searchBarSubViews count]; i++) {
if([[searchBarSubViews objectAtIndex:i] isKindOfClass:[UITextField class]])
{
UITextField* search=(UITextField*)[searchBarSubViews objectAtIndex:i];
[search setFont:[UIFont fontWithName:@"CustomFont" size:15]];
search.delegate = self;
[search setInputView:self.customKeyboard];
[self.customKeyboard setTextView:search];
}
}
It is working fine. However when i type with my custom keyboard and tap Cancel Button to resignFirstResponder
.
And i tap UISearchBar
again, i can't type any text in UISearchBar
, including native english keyboard.
And also Cancel Button is hiding and UISearchBar
is not working anymore.
I don't know why is happening?
How can i solve it?