删除searchBar 背景
2015-06-03 14:33
190 查看
不知道从哪个帖子上看到的
- (void)removeSearchBarFrame:(UISearchBar *)searchBar
{
float version = [[[UIDevice
currentDevice] systemVersion]
floatValue];
if ([searchBar respondsToSelector :
@selector (barTintColor)]) {
float iosversion7_1 = 7.1 ;
if (version >= iosversion7_1)
{
//iOS7.1
[[[[searchBar.subviews
objectAtIndex:0] subviews]
objectAtIndex:0] removeFromSuperview];
[searchBar setBackgroundColor:[UIColor
clearColor]];
}
else
{
//iOS7.0
[searchBar setBarTintColor:[UIColor
clearColor]];
[searchBar setBackgroundColor:[UIColor
clearColor]];
}
}
else
{
//iOS7.0
以下
[[searchBar.subviews
objectAtIndex:0] removeFromSuperview ];
[searchBar setBackgroundColor :[
UIColor clearColor]];
}
}
- (void)removeSearchBarFrame:(UISearchBar *)searchBar
{
float version = [[[UIDevice
currentDevice] systemVersion]
floatValue];
if ([searchBar respondsToSelector :
@selector (barTintColor)]) {
float iosversion7_1 = 7.1 ;
if (version >= iosversion7_1)
{
//iOS7.1
[[[[searchBar.subviews
objectAtIndex:0] subviews]
objectAtIndex:0] removeFromSuperview];
[searchBar setBackgroundColor:[UIColor
clearColor]];
}
else
{
//iOS7.0
[searchBar setBarTintColor:[UIColor
clearColor]];
[searchBar setBackgroundColor:[UIColor
clearColor]];
}
}
else
{
//iOS7.0
以下
[[searchBar.subviews
objectAtIndex:0] removeFromSuperview ];
[searchBar setBackgroundColor :[
UIColor clearColor]];
}
}
相关文章推荐
- C Primer Plus (第五版) 第十二章 存储类、链接和内存管理 编程练习
- ubuntu下VMware安装
- iOS8下定位
- Java中的集合--初级
- 设置oracle数据库密码永不过期(ORA-28002)
- can't reatcher to here
- HDU1028Ignatius and the Princess III(一个数有多少种组合方式,DP)与放n个苹果在m个盘子有多少生种组合一样(两种方法解)
- Js-加密
- iOS 在当前控制器中发送短信
- [linux] is not in the sudoers file
- 按中文排序
- Nginx安装部署
- 导航--XML文件
- 梯度下降法(最速下降法)
- Java中对象创建与引用
- 移位操作和二进制知识
- C++ 拷贝构造函数和赋值构造函数
- php发送邮件原理
- boost log 中打印源码的名字与行号的两种方法
- java程序作业代码