UISearchBar设置背景颜色
作者:
白日一山 | 来源:发表于
2016-09-12 11:17 被阅读0次@interface CFControllerController:UITableViewController<UISearchDisplayDelegate,UISearchBarDelegate>{
UISearchBar*mySearchBar;
}
@end
- (void)viewDidLoad {
mySearchBar=[[UISearchBar alloc]initWithFrame:CGRectMake(0,20,self.view.width,44)];
//直接设置背景颜色会在页面展示动画没有结束的时候显示灰色
//mySearchBar.backgroundColor = [UIColor clearColor];
//所以使用:
UIImage* clearImg = [[UIImage alloc]init];
[mySearchBar setBackgroundImage:clearImg];
//因为光标时白色的
mySearchBar.tintColor= [UIColor blueColor];
mySearchBar.delegate=self;
[mySearchBarsetPlaceholder:@"请输入内容"];
self.navigationItem.titleView=mySearchBar;
}
本文标题:UISearchBar设置背景颜色
本文链接:https://www.haomeiwen.com/subject/uijpettx.html
网友评论