cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

RefreshControl issue on tableView

perage
Participant
0 Likes
1,331

Hi,

I have a viewController with a tableView (not UITableViewController) and a FUINavigationBar. When adding refreshControll, the animations doesn't work like they should, e.g the NavigationBar doesn't always move back up, and the loading indicator is just blinking for a split second. When changing the NavigationBar back to UINavigationBar, it works like it should.

Any suggestions on how to fix this for FUINavigationBar? Also, any idea why the whitespace on the top is there - it came with xcode 12 I believe..

https://media.giphy.com/media/azBxx0ez5KwdRWn5ux/giphy.gif

@IBOutlet weak var table: UITableView!
let refreshControl = UIRefreshControl()
refreshControl.addTarget(self, action: #selector(refresh), for: .valueChanged)
refreshControl.tintColor = .white //this is needed as it is grey/black by default
table.refreshControl = refreshControl

On a side note it seems to me that there is some custom code here, trying to mimic Apple's animation from large title to small title for example. When scrolling down on a NB with large title on UINavigationBar it transitions to small very smooth, but with FUINavigationBar, it kind of jumps from large to small.

Accepted Solutions (0)

Answers (1)

Answers (1)

jan-hua_chu
Employee
Employee
0 Likes

In your case, please change the search bar to tableview header. i.e., change the following line

`navigationItem.searchController = searchController`

to

`tableView.tableHeaderView = searchController.searchBar`

Also, since this change will move the loading indicator to the table view header instead of the nevigation bar, the `refreshControl1.tintColor` you should change the color to a more noticable color than white, or just use the default color.

BTW, it is recommended to use `FUINavicationController` instead of `UINavigationController` to make the status bar text the correct color for iOS 13.4 and later. Note that simulators may display different color than the desired color, you need to use the real device to see the correct behavior.