问题描述
我想得到这样的东西:
但我无法删除原始背景(我正在使用iOS5)。
然而,似乎Apple做到了:
But I was not able to remove original background (I'm using iOS5).However, it seems Apple did it:
如何创建我想要的内容?
或者,没有选择,我唯一的选择是自定义UITextField?
How can I create what I want?Or, there is no choice and the only alternative I have is customize a UITextField?
感谢您的建议和意见!
编辑:第一次回复后,这就是我得到的:
After first reply, this is what I got:
有没有人如何在不使所有组件半透明变化其alpha值的情况下删除白色内部背景?顺便说一句,我可以用黑色改变白色吗?
Does anyone how can I remove white inner background without making all component semitransparent changing its alpha value? BTW, can I change white color by black color?
推荐答案
试试这个代码,它对我有用
Try this code,It worked for me
for (id img in yourSearchBar.subviews) {
if ([img isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) {
[img removeFromSuperview];
}
}
在上面的代码中,yourSearchBar是你的搜索栏想要删除背景,
并且for循环正在搜索UISearchBar的背景图片
In the above code yourSearchBar is the searchbar from which you want to remove the background,And the for loop is searching for the background image of UISearchBar
这篇关于可以从UISearchBar中删除背景或边框吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!