How c开发者_开发知识库an 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
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.
精彩评论