开发者

add searchbar in UItoolbar

开发者 https://www.devze.com 2023-01-03 20:24 出处:网络
i 开发者_Go百科want to know is this possible to add a searchbar in UItoolbarI just had a quick look and while interface builder will let you do it, when you try to save a warning pops up a warning say

i 开发者_Go百科want to know is this possible to add a searchbar in UItoolbar


I just had a quick look and while interface builder will let you do it, when you try to save a warning pops up a warning saying the following "UISearchBars are not supported in UIBarButtonItems in non-iPad documents". That being said, it might be possible to make your own view that looks and works like a UIToolbar that does allow a UISearchBar.


You can nest:

navItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView: m_searchBar] autorelease];


If you get an error stating:

 UISearchBars are not supported in UIBarButtonItems in non-iPad documents

adding a UISearchBar to a view within a UIBarButtonItem worked for me.

0

精彩评论

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

关注公众号