You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a TabmanViewController with the currentViewController having prefersStatusBarHidden set to true.
When selecting one of the cells in my currentViewController, a modal view controller is presented with prefersStatusBarHidden set to false.
This triggers a viewDidLayoutSubviews() -> setNeedsChildAutoInsetUpdate() -> autoInsetter.inset(...)
if scrollView.contentInset != requiredContentInset {letisTopInsetChanged= requiredContentInset.top != scrollView.contentInset.top
scrollView.contentInset = requiredContentInset
scrollView.scrollIndicatorInsets = requiredContentInset
// only update contentOffset if the top contentInset has updated.
if isTopInsetChanged {varcontentOffset= scrollView.contentOffset
contentOffset.y =-requiredContentInset.top // ⚠️We lose the current content offset here
scrollView.contentOffset = contentOffset
}}
As you can see, the scrollView.contentOffset.y is updated regardless of the current contentOffset.
I propose the following change:
if scrollView.contentInset != requiredContentInset {letisTopInsetChanged= requiredContentInset.top != scrollView.contentInset.top
lettopInsetDelta= requiredContentInset.top - scrollView.contentInset.top
scrollView.contentInset = requiredContentInset
scrollView.scrollIndicatorInsets = requiredContentInset
// only update contentOffset if the top contentInset has updated.
if isTopInsetChanged {varcontentOffset= scrollView.contentOffset
contentOffset.y -= topInsetDelta
scrollView.contentOffset = contentOffset
}}
Which updates the contentOffset to the delta of the inset change.
New Issue Checklist
Issue Description
I have a
TabmanViewController
with thecurrentViewController
havingprefersStatusBarHidden
set to true.When selecting one of the cells in my
currentViewController
, a modal view controller is presented withprefersStatusBarHidden
set to false.This triggers a
viewDidLayoutSubviews() -> setNeedsChildAutoInsetUpdate() -> autoInsetter.inset(...)
It goes in here: https://git.io/vhiyH
As you can see, the
scrollView.contentOffset.y
is updated regardless of the currentcontentOffset
.I propose the following change:
Which updates the
contentOffset
to the delta of the inset change.I can prepare a pull request if need be.
Other useful things
A video of the issue: https://gfycat.com/PleasedIcyBichonfrise
The text was updated successfully, but these errors were encountered: