AKSideMenu icon indicating copy to clipboard operation
AKSideMenu copied to clipboard

Behavior bug at additionalSafeAreaInsets when constraints fixed to bottom

Open fpazarbas opened this issue 4 years ago • 1 comments

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
        }
    }
}

fpazarbas avatar Sep 26 '21 14:09 fpazarbas

Hi @fpazarbas

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

dogo avatar Sep 27 '21 02:09 dogo