2013-06-02 143 views
0

我需要一些方法来隐藏工具箱,只要它是未使用的,所以我受到iPad Paper应用程序的启发。当用户在工具箱上向下滑动时,它滑落并且在屏幕之外,当您从屏幕底部向上滑动时,它会向上滑动。幻灯片显示/隐藏工具箱

enter image description here

可能有人请告诉我如何建立这个功能呢?

回答

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?