REFrostedViewController icon indicating copy to clipboard operation
REFrostedViewController copied to clipboard

How can I open the menu ONLY from the left edge of the view?

Open cfirbuvel opened this issue 11 years ago • 6 comments

cfirbuvel avatar Sep 20 '14 23:09 cfirbuvel

btw thank you for this cool app it help me alot with my final project

cfirbuvel avatar Sep 22 '14 22:09 cfirbuvel

Same Here!

ghost avatar Dec 09 '14 15:12 ghost

this is how I did it for right edge.

- (void)panGestureRecognized:(UIPanGestureRecognizer *)sender
{
    if ([sender locationInView:self.view].x > self.view.frame.size.width * 0.8 || self.frostedViewController.isVisible) {
        // Dismiss keyboard (optional)
        //
        [self.view endEditing:YES];
        [self.frostedViewController.view endEditing:YES];

        // Present the view controller
        //
        [self.frostedViewController panGestureRecognized:sender];
    }
}

mkeremkeskin avatar Feb 10 '15 10:02 mkeremkeskin

but what is "self.frostedViewController.isVisible"?

did you add another property?

cfirbuvel avatar Feb 15 '15 16:02 cfirbuvel

Yeah sorry to mention that I have forgotten about it. In order to understand whether the the menu is visible I have added a method. I wrote it down you can use it.

I have added the line to REFrostedViewController.h
- (bool)isVisible;

line to REFrostedViewController.m
- (bool) isVisible{
    return _visible;
} 

On my above code I'm controlling the right 20% of the screen from right edge. self.frostedViewController.isVisible this is required to continue the pangesture if the menu is visible.

mkeremkeskin avatar Feb 15 '15 16:02 mkeremkeskin

Thanks @mkeremkeskin for the inspiration. I have implemented it slightly different (don't need the isVisible logic) for the left side:

if ([sender locationInView:self.view].x < self.view.width * 0.2 || sender.state != UIGestureRecognizerStateBegan) {
    [self.frostedViewController panGestureRecognized:sender];
}

ricsantos avatar Apr 16 '15 07:04 ricsantos