scenee / FloatingPanel

A clean and easy-to-use floating panel UI component for iOS
MIT License
5.59k stars 508 forks source link

Fix for contentOffset #602

Closed artem-shmatkov closed 1 year ago

artem-shmatkov commented 1 year ago

Found a problem when I use FloatingPanel with UINavigationController which holds some controller with scrollView. When FloatingPanel goes from state to state scrollView's contentOffset becomes (0, 0) instead of (0, -44) (which is normal if there is a UINavigationBar). Tried to fix it here.

Also here are two examples before and after fix. before: https://github.com/scenee/FloatingPanel/assets/340680/eb6cb644-4bbe-4174-ac3e-25885600bffd after: https://github.com/scenee/FloatingPanel/assets/340680/da4a8e40-6923-45c4-b92e-eb151454f5f2

scenee commented 1 year ago

Thanks for your PR and report. Your example helped me recognize the problem. Let me check one point. Is this problem also happening in v2.6.1?

Thanks to this PR, I noticed that the change at 7511ce5 commit in version 2.6.2 was not appropriate for some cases. Therefore I’m thinking I will revert the change.

artem-shmatkov commented 1 year ago

Is this problem also happening in v2.6.1?

Looks like 2.6.1 doesn't have this problem.

scenee commented 1 year ago

Thank you for your quick confirmation. Based on the result, I was wondering if you could go back to the implementation of v2.6.1 in this PR. I should have noticed this when I reviewed it, but there is another issue with the current logic which only works with the bottom positioned panel(i.e. not with left/right positioned one). This is because it only uses y of contentOffset.

I would like to fix the problem v2.6.2 was trying to fix in a different way.

scenee commented 1 year ago

I'm closing this pull request to address the issue you reported. Thank you for your contribution. I'll add an acknowledgment to the next release note.