UISearchBar去除背景颜色
2015-08-09 21:47
387 查看
UISearchBar *searchBar=[[UISearchBar alloc]initWithFrame:frame]; //这个设置背景透明可能无效 searchBar.backgroundColor=[UIColor clearColor]; //可采用如下方法去除搜索框背景 for (UIView *view in searchBar.subviews) { // iOS7.0之前 if ([view isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) { [view removeFromSuperview]; break; } // iOS7.0+ if ([view isKindOfClass:NSClassFromString(@"UIView")] && view.subviews.count > 0) { [[view.subviews objectAtIndex:0] removeFromSuperview]; break; } }
相关文章推荐
- android Installation failed due to invalid URI! 错误处理
- IOS--UIImageView--帧动画
- PHP 用QueryList抓取网页内容
- UI控件
- UIWindow
- Duilib应用修改程序图标方法
- Duilib应用修改程序图标方法
- Duilib应用修改程序图标方法
- 树状数组 hdu2227 Find the nondecreasing subsequences
- hdoj 1711 Number Sequence
- (win7 UEFI安装)顺便说说UEFI、GPT和Secure Boot
- EasyUI----动态拼接EasyUI控件
- UIScrollView实现的简单视图切换
- Leetcode N-Queens系列
- 线段树 csu1555 Inversion Sequence
- MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(562,5): error MSB6006: “mt.exe”已退出,代码为 5
- Android系统UI设计之:视图
- UVA 348 Optimal Array Multiplication Sequence(最优矩阵链乘)
- Codeforces Round #303 Equidistant String
- iOS开发-- 如何让 UITableView 的 headerView跟随 cell一起滚动