Chr*_*ris 8 transparent uisearchbar uisearchcontroller
我UISearchBar添加到了顶部UITableView.
// init search bar
self.resultSearchController = ({
let controller = UISearchController(searchResultsController: nil)
controller.searchResultsUpdater = self
controller.dimsBackgroundDuringPresentation = false
controller.searchBar.sizeToFit()
controller.searchBar.tintColor = Config.grayColor()
controller.searchBar.searchBarStyle = UISearchBarStyle.Minimal
self.tableView.tableHeaderView = controller.searchBar
// set content offset for table view in order
// that the searchbar is hidden at the beginning
self.tableView.contentOffset = CGPoint(x: 0, y: controller.searchBar.frame.size.height)
return controller
})()
Run Code Online (Sandbox Code Playgroud)
这基本上看起来像预期:
但是当我进入搜索文本域并向下滚动表视图时,它看起来很奇怪.搜索控制器的背景是透明的.
我试着设置barTintColor和backgroundColor,但没有任何效果.
| 归档时间: |
|
| 查看次数: |
1200 次 |
| 最近记录: |