Chapter 15 Pull to Refresh

The PullToRefresh example works well with an iPhone 8, but not perfectly with an iPhone 11 Pro Max. When you pull down on the iPhone 11, the list bounces back too far and partially covers the animation. I’m guessing it has to do with the fact that on the iPhone 11, the list is fully contained on one page. Is there a workaround for that?

1 Like

I don’t know how to fix it, but I can tell you more about the issue.

You are correct that it has to do with the number of items and the height of the display. For the iPhone 11 Pro Max, it will fail if the number of items is 11 or 12. For the iPhone 8 Plus, it will fail if the number of items is 9 or 10.

It happens when the number of items is fully displayed when at rest, but goes off the bottom of the display when you pull down far enough to initiate the refresh.

You can tinker with the list if you first change the numberOfRowsInSection method to return packItems.count. Then you can comment out some of the items in packItems, or add a few more, to see when it fails.

Somewhere in the code, maybe in RefreshView.swift, it is setting a height or offset that is not correct if the list was originally not scrolled, but gets pulled off the bottom of the display when pulling down for a refresh. I haven’t figured out where, though.

1 Like

Weird enough, if you pull again while refreshing, the refresh view is displayed correctly. Thus, pulling twice seems to “fix” the issue internally; subsequent pulls while refreshing work just fine.

This topic was automatically closed after 166 days. New replies are no longer allowed.