Prevent UIRefreshControl from modifying developer-land `contentInsets` by using `adjustedContentInset`

Originator:eli.j.perkins
Number:rdar://35866834 Date Originated:12/5/17
Status:Open Resolved:
Product:UIKit Product Version:
Classification:Bug Reproducible:
 
When UIRefreshControl starts and stops animating, it mutates the current values for the table view's `contentInset`.

If the developer captures a value for content inset, the developer might assume that value won't be changed by UIKit itself, and can expect it to be the same until the developer changes it again. However, if a UIRefreshControl is added to a table view, and, outside of the context of where a developer might expect a table view's `contentInset` to be modified, `beginRefreshing` or `endRefreshing` is called, the table view's `contentInset` will be modified by UIKit internally. This can cause some unexpected behavior.

With iOS 11, `adjustedContentInset` provides a method, `adjustedContentInsetDidChange` for developers to be notified when UIKit wants to change `contentInset` values that are read-only for developers.

If UIRefreshControl were to use `adjustedContentInset` rather than `contentInset`, some unexpected behavior could be prevented.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!