iOS 11 UIRefreshControl with NavigationBar LargeTitle and SearchController disappearing
Asked Answered
G

3

18

I have a navigationBar with largeTitle and searchcontroller and my tableView has a refreshcontrol.

When I pull to refresh the activityIndicator of refreshcontrol disappear but de refresh process continues, even when the process finish and I call .endRefreshing() of UIRefreshControll the navigationBar doesn't back to the normal size.

enter image description here

Someone with the same problem?

Glen answered 17/10, 2017 at 15:23 Comment(2)
I'm having the exact same problem. After refreshing is complete, the underlying table view makes a jump back to its original position but the navigation bar stays in the refresh state. Have you found a solution yet?Tic
@Tic My answer may help you: https://mcmap.net/q/654083/-ios-11-uirefreshcontrol-with-navigationbar-largetitle-and-searchcontroller-disappearingArticulator
T
28

I searched a solution for this for weeks already and today, I finally made it work. The solution is so simple, I can't believe I haven't found that earlier.

I was using a normal UIViewController with a UITableView. My layout constraints were setup so that the UITableView was pinned with 0 to the bottom and top layout guides like so:

enter image description here

Once I changed that and pinned the UITableView to the Superview with 0 to all edges, it magically started to work:

enter image description here

I didn't even have to setup anything else. I hope so much that this does the fix for you as well because its just so annoying...


If the above doesn't work, than you need in addition to it, set

self.extendedLayoutIncludesOpaqueBars = YES;

or check the "Extend Edges / Under Opque Bar" in the Storyboard

Tic answered 10/11, 2017 at 5:35 Comment(5)
This saved me such a headache! Do you know why this was the case?Earing
Didn't worked for me unfortunately... (doing it via view code instead of storyboard)Icken
Do you setup constraints via code? Make sure to not pin your scroll view tot he layout guides or safe area but the superview top and bottom.Tic
@BrunoRocha my solution may help you: https://mcmap.net/q/654083/-ios-11-uirefreshcontrol-with-navigationbar-largetitle-and-searchcontroller-disappearingArticulator
This is awesome!Outwear
A
13

Try

self.extendedLayoutIncludesOpaqueBars = YES;

If you have opaque navigation bars that is. It fixed the issue for me.

Articulator answered 5/12, 2017 at 17:59 Comment(3)
It fixed for me ! ThanksGlen
Worked like a charm! The tableview jumped back up, but the navigation bar stayed big. Oh and the indicator was invisible... all fixed thanks to you!Gothard
This worked ONLY, when i done also what is in xxtesaxx answerGaffer
E
-1

Try to use this code snippet:

self.navigationController?.navigationBar.prefersLargeTitles = false
self.navigationController?.navigationBar.prefersLargeTitles = true;
Errantry answered 23/10, 2017 at 8:40 Comment(1)
Context? Where and when are you using this?Plausible

© 2022 - 2024 — McMap. All rights reserved.