- 使用UISearchController的时候,有时候在激活状态
- Attempting to load the view of a
- ios 对UISearchController的封装使所有的回
- Swift5.2 - UISearchController的简单
- iOS-UISearchBar、UISearchControll
- iOS 编程:UISearchController API 接口
- 开始用Swift开发iOS 10 - 18 Search Bar
- 使用UISearchController无法正确push界面
- 使用UISearchController需要注意的事项
- UISearchController的使用注意事项
使用UISearchController的时候,有时候在激活状态显示上偏移过多的情况处理,设置下列代码
self.definesPresentationContext = YES;
self.extendedLayoutIncludesOpaqueBars = YES;
设置UISearchController ,并自定义背景,激活状态背景颜色改变
- (UISearchController *)searchController {
if (_searchController == nil) {
_searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
_searchController.searchResultsUpdater = self;
_searchController.searchBar.placeholder = @"姓名/工号/电话/部门";
_searchController.hidesNavigationBarDuringPresentation = YES;
_searchController.searchBar.delegate = self;
_searchController.searchBar.backgroundImage = [UIImage imageWithColor:AB_Color_f2f2f2 size:_searchController.searchBar.size];
CGSize size = CGSizeMake(_searchController.searchBar.size.width, _searchController.searchBar.size.height + 20);
[_searchController.searchBar setBackgroundImage:[UIImage imageWithColor:AB_Color_f3f3f3 size:size] forBarPosition:UIBarPositionTopAttached barMetrics:UIBarMetricsDefault];
[_searchController.searchBar sizeToFit];
}
return _searchController;
}
网友评论