滑动以显示/隐藏工具箱

时间:2013-06-02 13:15:18

标签: ios slide

我需要一些隐藏工具箱的方法,只要它没有使用,所以我受到了iPad Paper应用程序的启发53 ..当用户向下滑动工具箱时,它向下滑动并离开屏幕,当您从屏幕底部向上滑动时,它会向上滑动。

enter image description here

有人可以告诉我如何创建这个功能吗?

1 个答案:

答案 0 :(得分:1)

只需添加滑动手势识别器,然后在viewDidLoad添加此

UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeup:)];
[recognizer setDirection:(UISwipeGestureRecognizerDirectionUp)];
[[self view] addGestureRecognizer:recognizer];
[recognizer release];

UISwipeGestureRecognizer *recognizer1 = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeDown:)];
[recognizer1 setDirection:(UISwipeGestureRecognizerDirectionDown)];
[[self view] addGestureRecognizer:recognizer1];
[recognizer1 release];

并实现这些选择器来查看和关闭具有工具箱的视图控制器。 使用此链接制作自定义尺寸How to present a modal view controller with custom size in center?

的视图控制器