标签:
UISearchBar http://blog.sina.com.cn/s/blog_7b9d64af0101dfg8.html
UISearchController
//创建
self.searchC = [[UISearchController alloc] initWithSearchResultsController:nil];
//设置代理
self.searchC.searchResultsUpdater = self;
self.searchC.delegate = self;
//设置UISearchController的显示属性,以下3个属性默认为YES //搜索时,背景变暗色 _searchController.dimsBackgroundDuringPresentation = NO; //搜索时,背景变模糊 _searchController.obscuresBackgroundDuringPresentation = NO; //隐藏导航栏 _searchController.hidesNavigationBarDuringPresentation = NO;
//设置searchbar自适应位置
[self.searchC.searchBar sizeToFit];
//设置背景颜色
self.searchC.searchBar.barTintColor = [UIColor yellowColor];
//搜索栏的内容发生变化时, 会触发代理方法
- (void)updateSearchResultsForSearchController:(UISearchController *)searchController;
标签:
原文地址:http://www.cnblogs.com/lion-witcher/p/5742760.html