handsomecode / InteractiveSideMenu

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

Button constraints are corrupt on iPad / button is moving when closing MenuViewController #66

Closed welljsjs closed 6 years ago

welljsjs commented 6 years ago

Hey,

I am having some trouble with InteractiveSideMenu. I tried to use the framework for iPad running iOS 11, but there seems to be a problem; the first time I close the side-menu, my button moves about 20px to the top. I attached some pictures of it. I am using the same constraints as in your official Sample project.

The console output:

[LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x600000280550 UILayoutGuide:0x6000001b9360'UIViewSafeAreaLayoutGuide'.bottom == UITableView:0x7f8f3f823c00.bottom + 20   (active)>",
    "<NSLayoutConstraint:0x600000280730 UITableView:0x7f8f3f823c00.centerY == UIView:0x7f8f3f400ce0.centerY   (active)>",
    "<NSLayoutConstraint:0x600000280780 UITableView:0x7f8f3f823c00.top == UILayoutGuide:0x6000001b9360'UIViewSafeAreaLayoutGuide'.top   (active)>",
    "<NSLayoutConstraint:0x600000280640 'UIViewSafeAreaLayoutGuide-bottom' V:[UILayoutGuide:0x6000001b9360'UIViewSafeAreaLayoutGuide']-(0)-|   (active, names: '|':UIView:0x7f8f3f400ce0 )>",
    "<NSLayoutConstraint:0x6000002805a0 'UIViewSafeAreaLayoutGuide-top' V:|-(0)-[UILayoutGuide:0x6000001b9360'UIViewSafeAreaLayoutGuide']   (active, names: '|':UIView:0x7f8f3f400ce0 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600000280730 UITableView:0x7f8f3f823c00.centerY == UIView:0x7f8f3f400ce0.centerY   (active)>

This might refer to #53 , but I am not sure.

bildschirmfoto 2017-11-30 um 21 16 25 bildschirmfoto 2017-11-30 um 21 17 20 bildschirmfoto 2017-11-30 um 21 17 27 bildschirmfoto 2017-11-30 um 21 17 33
hintoz commented 6 years ago

Known Issues There is an issue associated with scaling of NavigationBar in iOS 11. Status bar background is hidden during side menu closing if contentScale < 1. It’s supposed to be iOS 11 Navigation Bar issue that's been reported to Apple.

enmiller commented 6 years ago

@welljsjs There appears to be a critical range with the contentScale property of the TransitionOptions that causes the odd behavior. When using a contentScale of 0.87 - 0.90, there seems to be an issue with the content controller's view not getting its safeAreaInsets set properly. From testing, I can only see it affecting those four values in that range.

I will continue to look into the issue but, for now, I will update the default value of the contentScale to be outside of this range so that the library works on iOS 11 by default

For now, you can change the transitionOptions to be outside of that range and you should see things improve.

enmiller commented 6 years ago

@welljsjs Try using 2.2.1. The default contentScale was changed to be outside of the affected range that causes the safeAreaInsets not to be set properly on the content controller.

I will still be looking into this issue to see how I can make things work no matter the contentScale setting but this is the best I can do for now.