In iOS7, the contentInsets of UISrollView can't be restored when using SVPullToRefresh in a UIViewController which is embedded in a UINavigationController #262
I found the reason, that is the default value of automaticallyAdjustsScrollViewInsets in UIViewController is YES so the UIViewController will adjust the contentInsets of UIScrollView or UITableView. However in viewDidLoad method, contentInsets is (0, 0, 0, 0), which means adjusting doesn't happen here, but in viewDidLayoutSubviews method, contentInsets is (64, 0, 0, 0).
I looked into the source code and found that in addPullToRefreshWithActionHandler: method, it keep the original contentInsets and try to restore it when finish refreshing. So I recommend to use addPullToRefreshWithActionHandler: in viewDidLayoutSubviews.
I found the reason, that is the default value of
automaticallyAdjustsScrollViewInsets
in UIViewController isYES
so the UIViewController will adjust the contentInsets ofUIScrollView
orUITableView
. However inviewDidLoad
method,contentInsets
is (0, 0, 0, 0), which means adjusting doesn't happen here, but inviewDidLayoutSubviews
method,contentInsets
is (64, 0, 0, 0).I looked into the source code and found that in
addPullToRefreshWithActionHandler:
method, it keep the original contentInsets and try to restore it when finish refreshing. So I recommend to useaddPullToRefreshWithActionHandler:
inviewDidLayoutSubviews
.