I've been trying to find the solution for hours, but alas no dice... I've been trying to implement a UISearchBar purely programatically (no xib, no interface builder).
Here is my .h header:
@interface RLCASearchMasterViewController : UIViewController<UISearchBarDelegate>
@property (strong, nonatomic) RLCAGUIElements *gui;
@property (strong, nonatomic) RLCAUITableView *table;
@property (strong, nonatomic) UISearchBar *searchBar;
@end
and my .m implementation:
@synthesize searchBar;
- (void)loadView
{
[super loadView];
searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, searchBar.frame.size.height)];
searchBar.delegate = self;
[self.view addSubview:searchBar];
}
I'd gone over this I don't know how many times, and have no idea what I'm doing wrong... The UISearchBar is added to the view just fine, with the correct size and all, however when clicked/tapped, the keyboard does not come up. If I evoke the following however:
[searchBar becomeFirstResponder];
the keyboard does show, so it's probably not the delegation but actually detecting whether it's been clicked... I do not want it to edit on load though, and only by request...
Please help. Thanks! :)
Sincerely, Piotr.