xmartlabs / XLActionController

Fully customizable and extensible action sheet controller written in Swift
MIT License
3.33k stars 317 forks source link

Fix incorrect top inset and content offset #126

Closed migrant closed 5 years ago

migrant commented 5 years ago

If you'd like to test the effect it cases, just simply delete any 4 of 5 actions in SpotifyExampleViewController and then run it. Then drag down the view. The action cells are covered by the cancel view even the hideCollectionViewBehindCancelView is true. When setting the hideCollectionViewBehindCancelView to false in SpotifyActionController. The effect is more obvious than the fist one. The initial offset is messed up.

This pr fix several issues about top inset and content offset:

  1. contentHeight already contains the cancelView's height when it calculated in viewDidLoad. So there is no need to minus it again.
  2. The minimum top inset is safeAreaInsets.top + 30. In other words, if the top inset is already greater than the minimum number, it should not plus the top value.
  3. As mentioned above, contentHeight contains cancelView's height, and bottomInset contains the height as well, which case the incorrect initial content offset.
migrant commented 5 years ago

Thanks for merging. Could you please release a new version so that I can use it in my project?

mats-claassen commented 5 years ago

Done!