I have a UISearchBar programatically and works but if I try to set a placeholder and user tap to search something my app crash. This is my code:
Property
@property (strong, nonatomic) UISearchBar *mySearchBar;
Implementation
self.mySearchBar = [[UISearchBar alloc] init];
self.mySearchBar.delegate = self;
self.mySearchBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
self.mySearchBar.autocorrectionType = UITextAutocorrectionTypeNo;
self.mySearchBar.translucent = NO;
self.mySearchBar.returnKeyType = UIReturnKeySearch;
self.mySearchBar.autocorrectionType = UITextAutocorrectionTypeNo;
self.mySearchBar.inputAccessoryView = toolBarKeyboard;
self.mySearchBar.placeholder = @"Artist, Team or City";
This line makes crash when user tap in uisearchbar to find some data
self.mySearchBar.placeholder = @"Artist, Team or City";
Someone else with this error?
I use:
- Xcode 6
- iOS 8
- iPhone 5 / 5s
SearchViewController
your class? Does your class try to access the_searchController
property/ivar? Show that code. – rmaddy_searchController
value? – rmaddy