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?

Charles Lima
  • 381
  • 4
  • 9
  • 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? – xxtesaxx Nov 10 '17 at 05:19
  • @xxtesaxx My answer may help you: https://stackoverflow.com/a/47659869/2145198 – beebcon Dec 05 '17 at 18:00

3 Answers3

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

Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
xxtesaxx
  • 6,175
  • 2
  • 31
  • 50
13

Try

self.extendedLayoutIncludesOpaqueBars = YES;

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

beebcon
  • 6,893
  • 5
  • 25
  • 27
-1

Try to use this code snippet:

self.navigationController?.navigationBar.prefersLargeTitles = false
self.navigationController?.navigationBar.prefersLargeTitles = true;
wj2061
  • 6,778
  • 3
  • 36
  • 62