handsomecode / InteractiveSideMenu

iOS Interactive Side Menu written in Swift.
Apache License 2.0
708 stars 163 forks source link

I need to get the view.safeAreaInsets.top #101

Closed El-Buritos closed 6 years ago

El-Buritos commented 6 years ago

My app is design programatically and I need to get the view.safeAreaInsets.top but by the way when I test to get it in a view contains the SideMenuItemContent, this code if #available(iOS 11.0, *) { topSafeArea = view.safeAreaInsets.top } else { topSafeArea = topLayoutGuide.length } return always a 0 value..

Basically because the view containing in the host are embed in itself...

How can I get this value ?

El-Buritos commented 6 years ago

solved by if (@available(iOS 11.0, *)) { UIWindow *window = UIApplication.sharedApplication.keyWindow; CGFloat topPadding = window.safeAreaInsets.top;