简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM