twone twone - 5 months ago 28
iOS Question

Panel sliding from the bottom

I want to implement panel, that by default appears from the bottom only by 1/4.
And when i tap on this part, or swipe it, it should roll out on full screen.

exactly what i want was implemented in this app

So what i tried already:
Making UIView and trying to apply tap and swipe gestures. UIView didn't catch it. But it caught touchesMoved, touchesEnded etc.
UITableView. Same.
Making UIViewController. Ended without any idea how to handle it to right way.

So any ideas or links are appreciated.
Thanks in advance.

Answer

Check PPRevealSideViewController https://github.com/ipup/PPRevealSideViewController, I think you can find what you need. When you tap on the new viewController you can change the Offset.

AppDelegate.m

MainViewController *main = [[MainViewController alloc] init];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
main = [storyboard instantiateViewControllerWithIdentifier:@"MainViewControllerr"];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:main];
_revealSideViewController = [[PPRevealSideViewController alloc] initWithRootViewController:nav];
_revealSideViewController.delegate = self;
self.window.rootViewController = _revealSideViewController;

MainViewController.m

-(void)popViewController{
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    PoppedViewController *pvc = [storyboard instantiateViewControllerWithIdentifier:@"PoppedViewController"];
    [self.revealSideViewController pushViewController:pvc onDirection:PPRevealSideDirectionBottom withOffset:_offset animated:_animated completion:nil];
}

PoppedViewController.m

-viewDidLoad{
    //...
    UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(getFullView)];
    gesture.delegate = self;
    [self.view addGestureRecognizer:gesture];
}

-getFullView{
    [self.revealSideViewController changeOffset:0.0f forDirection:PPRevealSideDirectionLeft];
}