I create a programmatically refresh on my table view using this code
extension UIRefreshControl {
func beginRefreshingManually() {
if let scrollView = superview as? UIScrollView {
scrollView.setContentOffset(CGPoint(x: 0, y: scrollView.contentOffset.y - frame.height), animated: true)
}
beginRefreshing()
sendActions(for: .valueChanged)
}
}
It works fine if navigationController?.navigationBar.prefersLargeTitles = false
but if it is true then the UIRefreshControl is not visible, see the output below
This is the result if navigationController?.navigationBar.prefersLargeTitles = false
As you can see, after the view was load, it automatically spin the UIRefreshControl
, because I call the tableView.refreshControl?.beginRefreshingManually()
on viewDidAppear
And this is the result if navigationController?.navigationBar.prefersLargeTitles = true
As you can see, it loaded the function that call on refreshControl.addTarget(self, action: #selector(refresh), for: .valueChanged)
but the spinning animation is not visible.
This is the code where I set up the navigation bar large title
private func setupNaigationBar() {
navigationController?.navigationItem.largeTitleDisplayMode = .always
let style = NSMutableParagraphStyle()
style.firstLineHeadIndent = 10 // This is added to the default margin
navigationController?.navigationBar.prefersLargeTitles = true
navigationController?.navigationBar.largeTitleTextAttributes = [NSAttributedString.Key.font : UIFont(name: "Avenir-Heavy", size: 25)!, .foregroundColor: Keys.primaryColor, NSAttributedString.Key.paragraphStyle : style]
navigationController?.navigationBar.backgroundColor = .clear
view.layoutIfNeeded()
}
My expected result was to see the UIRefreshControl
even if navigationController?.navigationBar.prefersLargeTitles = true
programatically (without even scrolled by user)