gresrun / GHSidebarNav

A clone of the new Facebook iOS UI paradigm
Apache License 2.0
607 stars 136 forks source link

How to make view not clickable when open menu #25

Closed Alkalouti closed 11 years ago

Alkalouti commented 11 years ago

First i want to thank you for this great job but i have a problem when slide the menu how to get the view not clickable and thanks again for great job

gresrun commented 11 years ago

Try setting [self.revealVC.contentViewController.view setUserInteractionEnabled:NO]; when you open the menu.

Alkalouti commented 11 years ago

please where i should put this code and how to get setUserInteractionEnabled:YES again thanks again

gresrun commented 11 years ago

I goes in your app. :smiley: Seriously, I need some context here if you want my help.

Alkalouti commented 11 years ago

:+1: hhhhhhhhh i have profile for user and i want to change cover for user i put gesture on image when pressed on it open uiaction sheet i want when click to the menu make view not clickable thanks again for your help

iOS Simulator Screen shot Apr 24 2013 4 04 09 PM

gresrun commented 11 years ago

Well it actually looks like the place to put it would probably be in GHRevealViewController:

- (void)toggleSidebar:(BOOL)show duration:(NSTimeInterval)duration completion:(void (^)(BOOL finsihed))completion {
    __weak GHRevealViewController *selfRef = self; // ADDED
    void (^animations)(void) = ^{
        if (show) {
            _contentView.frame = CGRectOffset(_contentView.bounds, kGHRevealSidebarWidth, 0.0f);
            [_contentView addGestureRecognizer:_tapRecog];
            [selfRef.contentViewController.view setUserInteractionEnabled:NO]; // ADDED
        } else {
            if (self.isSearching) {
                _sidebarView.frame = CGRectMake(0.0f, 0.0f, kGHRevealSidebarWidth, CGRectGetHeight(self.view.bounds));
            } else {
                [_contentView removeGestureRecognizer:_tapRecog];
            }
            _contentView.frame = _contentView.bounds;
            [selfRef.contentViewController.view setUserInteractionEnabled:YES]; // ADDED
        }
        self.sidebarShowing = show;
    };
    if (duration > 0.0) {
        [UIView animateWithDuration:duration
                              delay:0
                            options:UIViewAnimationOptionCurveEaseInOut
                         animations:animations
                         completion:completion];
    } else {
        animations();
        completion(YES);
    }
}

Try changing that, and if that's what you want, I'll commit it.

Alkalouti commented 11 years ago

thanks a lot it's work successfully thanks for your feedback