`
liubo0_0
  • 浏览: 21828 次
社区版块
存档分类
最新评论

设置 UISerachBar 的背景 透明

 
阅读更多
for (UIView *subview in searchBar.subviews) {
if ([subview isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) {
[subview removeFromSuperview];
break;
}
}


如果想自定义背景样式
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"40-di.png"]];
[mySearchBar insertSubview:imageView atIndex:1];
[imageView release];


//改变搜索按钮文字

//改变UISearchBar取消按钮字体

for(id cc in [searchBar subviews])

{

if([cc isKindOfClass:[UIButton class]])

{

UIButton *btn = (UIButton *)cc;

[btn setTitle:@"搜索"forState:UIControlStateNormal];

}

}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics