Open cfirbuvel opened 9 years ago
Same Here!
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];
}
}
but what is "self.frostedViewController.isVisible"?
did you add another property?
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.
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];
}
btw thank you for this cool app it help me alot with my final project