iOS-Slide-Menu icon indicating copy to clipboard operation
iOS-Slide-Menu copied to clipboard

Slide Menu does not work well in IOS 11

Open JeeGee1983 opened this issue 8 years ago • 9 comments

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!

JeeGee1983 avatar Sep 21 '17 14:09 JeeGee1983

Have you fixed the bug with crash?

x3mall1986 avatar Sep 25 '17 08:09 x3mall1986

Same here. Could anyone fix this issue ?

alpmusti avatar Sep 25 '17 09:09 alpmusti

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;

JeeGee1983 avatar Sep 25 '17 09:09 JeeGee1983

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

kuldeep13990 avatar Oct 17 '17 05:10 kuldeep13990

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

alpmusti avatar Oct 17 '17 08:10 alpmusti

still not resolved!!!

mrMash avatar Oct 23 '17 14:10 mrMash

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

shibbyy avatar Oct 23 '17 17:10 shibbyy

its solved Thanks

mrMash avatar Oct 23 '17 18:10 mrMash

Does not work for me.

signsi avatar Jan 31 '18 14:01 signsi