Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior bug at additionalSafeAreaInsets when constraints fixed to bottom #81

Open
fpazarbas opened this issue Sep 26, 2021 · 1 comment

Comments

@fpazarbas
Copy link

there was behavior bug when contentviewcontroller fixed to bottom safearealayoutguide.

I have added following code to my project at AKSideMenu updateContentViewAdditionalSafeAreaInsets()
after setting insets.top.
let window = UIApplication.shared.keyWindow
let bottomPadding = window?.safeAreaInsets.bottom
if insets.bottom < bottomPadding! {
insets.bottom = bottomPadding!
}else if insets.bottom <= bottomPadding! {
insets.bottom = 0.0
}
here is full version
func updateContentViewAdditionalSafeAreaInsets() {
if #available(iOS 11.0, *) {
if var insets = self.contentViewController?.additionalSafeAreaInsets {
insets.top = self.contentViewContainer.frame.minY
let topSafeArea = self.view.safeAreaLayoutGuide.layoutFrame.minY
if insets.top > topSafeArea {
insets.top = topSafeArea
} else if insets.top < 0.0 {
insets.top = 0.0
}
let window = UIApplication.shared.keyWindow
let bottomPadding = window?.safeAreaInsets.bottom
if insets.bottom < bottomPadding! {
insets.bottom = bottomPadding!
}else if insets.bottom <= bottomPadding! {
insets.bottom = 0.0
}

            self.contentViewController?.additionalSafeAreaInsets = insets
        }
    }
}
@dogo
Copy link
Owner

dogo commented Sep 27, 2021

Hi @fpazarbas

Thanks for reporting this issue, please test this branch fix/bottom-safe-area

@dogo dogo mentioned this issue Nov 30, 2021
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants