简体   繁体   English

面板从底部滑动

[英]Panel sliding from the bottom

I want to implement panel, that by default appears from the bottom only by 1/4. 我要实现面板,默认情况下仅从底部开始以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并尝试应用点击和滑动手势。 UIView didn't catch it. UIView没有抓住它。 But it caught touchesMoved, touchesEnded etc. UITableView. 但是它捕获了touchesMoved,touchesEnded等UITableView。 Same. 相同。 Making UIViewController. 制作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. 检查PPRevealSideViewController https://github.com/ipup/PPRevealSideViewController ,我认为您可以找到所需的东西。 When you tap on the new viewController you can change the Offset. 当您点击新的viewController时,您可以更改Offset。

AppDelegate.m 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 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 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];
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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