iOSのコントロールセンターUIViewController
みたいなメインビューを上下にスワイプしたい。
VC1 の半分が見える VC2 を表示しました。ユーザーが指を使用して VC2 のビューをスワイプすると、コントロール センターのように上下にスワイプします。
上下にスワイプしましたが、iOSのコントロールセンターのUISwipeGestureRecognizer
ようにアニメーション化されていません
編集:
- (void)viewDidLoad {
[super viewDidLoad];
UISwipeGestureRecognizer *gestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeDownHandler:)];
[gestureRecognizer setDirection:(UISwipeGestureRecognizerDirectionDown)];
[self.view addGestureRecognizer:gestureRecognizer];
UISwipeGestureRecognizer *gestureRecognizer1 = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeUpHandler:)];
[gestureRecognizer1 setDirection:(UISwipeGestureRecognizerDirectionUp)];
[self.view addGestureRecognizer:gestureRecognizer1];
}
-(void)swipeUpHandler:(UISwipeGestureRecognizer *)recognizer{
[UIView animateWithDuration:0.3 animations:^{
[self.view setFrame:CGRectMake(0,25, self.view.frame.size.width, self.view.frame.size.height)];
}];
}
-(void)swipeDownHandler:(UISwipeGestureRecognizer *)recognizer {
[UIView animateWithDuration:0.3 animations:^{
[self.view setFrame:CGRectMake(0,self.view.frame.size.height, self.view.frame.size.width, self.view.frame.size.height)];
}];
}
誰でも方法を知っていますか?