开发者

inputAccessoryView from UISearchBar

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜