开发者

Is it allowed to change the background of an UISearchBar?

开发者 https://www.devze.com 2023-02-07 05:48 出处:网络
I have been searching thru the web but cant find a confirmed answer. There are ways like removing the subview within the searchbar.subviews but is that allowed?

I have been searching thru the web but cant find a confirmed answer. There are ways like removing the subview within the searchbar.subviews but is that allowed?

If not then, aside from changing the tintColor of SearchBar, or use a textfi开发者_JAVA百科eld instead, is there a way that wont break apple's rule and still being able to customize the background of searchBar?

Thanks!


You are not breaking apple's rules if you are not conflicting with private API's.


I worked on a shipping app that made the background of the search bar transparent. There were no problems with this.


A solution I've seen used a lot (albeit only on toolbars and navigation bars, so I'm not 100% sure it'll work the same way): subclass UISearchBar and override its -drawRect:, drawing your own background image within the view's bounds.

0

精彩评论

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