Reputation: 1628
How can I access to inputAccessoryView
propery from UISearchBar
? I mean there's no UITextField
property in UISearchBar
that by it I could access to inputAccessoryView
.
Regards
Upvotes: 2
Views: 1502
Reputation: 2226
You can cheat a little here, though I think iOS 6 makes this assignable now. Anyway something like this:
for (UIView* v in _mySearchBar.subviews) {
if ([v isKindOfClass:[UITextField class]]) {
((UITextField*)v).inputAccessoryView = _inputToolbarAccessory;
}
}
Things like this can be dangerous if Apple changes the way they designed that particular widget, but I find myself doing it more often than I probably should.
Upvotes: 1