[英]UIRefreshControl renders behind UINavigation w/ Large Titles
I am trying to create a UITableViewController
, with a UINavigationBar
using large titles.我正在尝试创建一个
UITableViewController
,其中UINavigationBar
使用大标题。
The trouble I am having is, when using pull to refresh on an empty table view, the loading indicator is behind the text for the large title.我遇到的问题是,当在空表视图上使用 pull 刷新时,加载指示器位于大标题的文本后面。
If I pull to refresh a second time it does not have this issue.如果我第二次拉刷新它没有这个问题。
I have attached a gif that shows the behaviour.我附上了一个显示行为的 gif。
My view controller is very simple at this point我的观点 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"
}
}
It looks like you are setting the refresh control after the large navigation has been configured.配置大导航后,您似乎正在设置刷新控件。
Try changing the order to something like this -尝试将顺序更改为这样的 -
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"
}
Maybe you can try this in your viewDidLoad()也许你可以在你的 viewDidLoad()
self.edgesForExtendedLayout = []
it makes your table view doesn't conflict with your navigation bar它使您的表格视图与导航栏不冲突
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.