aryaxt / iOS-Slide-Menu

iOS Slide Menu with ability to add both left and right menu, and built in gesture recognizer. Similar to Path and Facebook
Other
1.52k stars 359 forks source link

Slide Menu does not work well in IOS 11 #250

Open JeeGee1983 opened 7 years ago

JeeGee1983 commented 7 years ago

The - (void)setEnableShadow:(BOOL)enable method does not work in IOS 11.

It's a problem with self.view in this method. self.view.layer.shadowColor = [UIColor darkGrayColor].CGColor;

*** Assertion failure in -[_UINavigationBarVisualProviderModernIOS _contentViewFittingHeight], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3694.4.18/_UINavigationBarVisualProviderModernIOS.m:544

Any idea how to solve this? Thanks!

x3mall1986 commented 7 years ago

Have you fixed the bug with crash?

alpmusti commented 7 years ago

Same here. Could anyone fix this issue ?

JeeGee1983 commented 7 years ago

I'm still testing but until now it looks okay.

I added this code in - (void)viewWillLayoutSubviews:

- (void)viewWillLayoutSubviews
{
    [super viewWillLayoutSubviews];

for (UIView *aView in self.navigationBar.subviews)
    {
        if ([aView isKindOfClass:NSClassFromString(@"_UINavigationBarContentView")])
        {
            aView.frame = CGRectMake(0, 0, aView.frame.size.width, aView.frame.size.height);
          aView.clipsToBounds = YES;
        }
    }

//moved this from the `setup` function: 
    self.enableShadow = YES;
    self.enableSwipeGesture = YES;
kuldeep13990 commented 7 years ago

@JeeGee1983 My app still crash with above warning as you mentioned.

alpmusti commented 7 years ago

@kuldeep13990

Try this way :

- (void)setup
{
    [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"ssidName"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    if (singletonInstance)
        NSLog(@"Singleton instance already exists. You can only instantiate one instance of SlideNavigationController. This could cause major issues");

    singletonInstance = self;

    self.menuRevealAnimationDuration = MENU_SLIDE_ANIMATION_DURATION;
    self.menuRevealAnimationOption = MENU_SLIDE_ANIMATION_OPTION;
}

- (void)viewWillLayoutSubviews
{
    [super viewWillLayoutSubviews];

    // Update shadow size of enabled
    if (self.enableShadow)
        self.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.view.bounds].CGPath;
    self.landscapeSlideOffset = self.view.frame.size.width/6;
    self.portraitSlideOffset = self.view.frame.size.width/6;
    self.panGestureSideOffset = 0;
    self.avoidSwitchingToSameClassViewController = YES;
    self.enableShadow = YES;
    self.enableSwipeGesture = NO;
    self.delegate = self;
    // When menu open we disable user interaction
    // When rotates we want to make sure that userInteraction is enabled again
    [self enableTapGestureToCloseMenu:NO];

    if (self.menuNeedsLayout)
    {
        [self updateMenuFrameAndTransformAccordingToOrientation];

        // Handle different horizontal/vertical slideOffset during rotation
        // On iOS below 8 we just close the menu, iOS8 handles rotation better so we support keepiong the menu open
        if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0") && [self isMenuOpen])
        {
            Menu menu = (self.horizontalLocation > 0) ? MenuLeft : MenuRight;
            [self openMenu:menu withDuration:0 andCompletion:nil];
        }

        self.menuNeedsLayout = NO;
    }
}
mrMash commented 7 years ago

still not resolved!!!

shibbyy commented 7 years ago

@mrMash What's the exact problem you facing now?

mrMash commented 7 years ago

its solved Thanks

signsi commented 6 years ago

Does not work for me.