![](/img/trans.png)
[英]Glitchy animation of UIRefreshControl with large titles or searchbar in navigation bar
[英]UIRefreshControl renders behind UINavigation w/ Large Titles
我正在嘗試創建一個UITableViewController
,其中UINavigationBar
使用大標題。
我遇到的問題是,當在空表視圖上使用 pull 刷新時,加載指示器位於大標題的文本后面。
如果我第二次拉刷新它沒有這個問題。
我的觀點 controller 在這一點上很簡單
final class FeedSceneViewController: UITableViewController {
private var loader: FeedLoader?
convenience init(loader: FeedLoader) {
self.init()
self.loader = loader
}
override func viewDidLoad() {
super.viewDidLoad()
tableView.refreshControl = .init()
load()
configureTableView()
configureUI()
}
func load() {
tableView.refreshControl?.set(isRefreshing: true)
loader?.load(then: { [weak self] _ in self?.refreshControl?.set(isRefreshing: false) })
}
}
private extension FeedSceneViewController {
func configureTableView() {
tableView.backgroundColor = .usingHex("fafafa")
tableView.tableFooterView = .init()
}
func configureUI() {
navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.title = "Latest content"
}
}
配置大導航后,您似乎正在設置刷新控件。
嘗試將順序更改為這樣的 -
override func viewDidLoad() {
super.viewDidLoad()
load()
configureTableView()
configureUI()
}
.......
func configureTableView() {
tableView.backgroundColor = .usingHex("fafafa")
tableView.tableFooterView = .init()
tableView.contentInsetAdjustmentBehavior = .always
tableView.refreshControl = .init()
}
func configureUI() {
navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.title = "Latest content"
}
也許你可以在你的 viewDidLoad()
self.edgesForExtendedLayout = []
它使您的表格視圖與導航欄不沖突
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.