2013-06-02 144 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?