iosuinavigationbarios11uirefreshcontrol

Sticky UINavigationbar after RefreshControl refreshed since iOS 11


navbar stays big

We have a modulised App using two Navigation-hierarchies, therefore the two stacked Navbars… Sometimes, when pulling the refreshcontrol the navbar stays big and does not drop back to the normal size after finishing the refresh. I can only guess, in which case it drops back and in which it doesnt… Visual debugger shows, that the view using this space is a _UINavigationBarLargeTitleView. In viewDidLoad, the self.navigationController.navigationBar.prefersLargeTitles is set to NO.

enter image description here

RefreshControl is added in viewDidLoad via:

self.refreshControl = [RefreshControl new];

Some things i already tried:

Does anyone have an idea what could cause this problem? As i said, i am not even sure when exactly this happens and when not…


Solution

  • It seems that this issue only happens when navigationBar.isTranslucent == false. I needed this setting to get a real 100% black navigation bar.

    For the time being I use this extremely dirty hack, inspired by the answer of Exception:

    self.refreshControl?.endRefreshing()
    if #available(iOS 11.0, *) {
        self.navigationController?.navigationBar.isTranslucent = true
        self.navigationController?.navigationBar.isTranslucent = false
    }