I programmatically added a UISearchBar in the view, did some initial setup. However, when I tap the search bar, the keyboard is not showing up. I looked up some question on this site, and none seems working for me.
Here is the code snippets I used to setup the search bar
self.searchBar = [[UISearchBar alloc]initWithFrame:CGRectMake(origin.x,origin.y,width,height)];
self.searchBar.searchBarStyle = UISearchBarStyleDefault;
self.searchBar.translucent = YES;
self.searchBar.barTintColor = [UIColor whiteColor];
...
[self.searchBar setDelegate:self];
[self.view addSubView:self.searchBar];
Any suggestions on fix this? Thanks!
If you're using Xcode 6.0.1, its possible that your hardware keyboard is taking over for the simulator keyboard. When running the simulator, make sure this option is unchecked. This should trigger the simulator keyboard when you tap in your Search Bar:
]
Also, this post explains how to get back to the behavior of the keyboard in Xcode 5.1.1:
In Xcode 6, how do I use the hardware keyboard but display the software keyboard in the iOS simulator
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With