简体   繁体   English

添加手势识别器

[英]Add Gesture recognizer

I have two viewController : FirstViewController and SecondViewController 我有两个viewController:FirstViewController和SecondViewController

I make an animation that make a view come from right to left. 我制作了一个动画,使视图从右到左。

I want when a make a sweep to right the SecondViewController hide and show the FirstViewController 我想要在向右扫视SecondViewController时隐藏并显示FirstViewController

the animation work there is the code 动画作品中有代码

SecondViewController *secondViewController = [[SecondViewController alloc]      initWithNibName:@"PlayListController" bundle:nil];
// Set up view2
secondViewController.view.frame = self.view.frame;
secondViewController.view.center = CGPointMake(self.view.center.x +   CGRectGetWidth(self.view.frame), self.view.center.y);
[self.view.superview addSubview:secondViewController.view];
// Animate the push
[UIView beginAnimations: nil context: NULL];
[UIView setAnimationDelegate: self];
[UIView setAnimationDidStopSelector: @selector(pushAnimationDidStop:finished:context:)];
secondViewController.view.center = self.view.center;
self.view.center = CGPointMake(self.view.center.x - CGRectGetWidth(self.view.frame), self.view.center.y);
[UIView commitAnimations];

I added a buttons to hide the view with an animation but it doesn't work ?? 我添加了一个按钮来隐藏带有动画的视图,但是它不起作用?

  1. Add a gesture recogniser to your view. 将手势识别器添加到视图中。
  2. In the callback, pop the view controller. 在回调中,弹出视图控制器。

Caveat: this is non standard UI. 注意:这是非标准的UI。 Better go with a standard navigation bar and a back button. 最好使用标准导航栏和后退按钮。

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

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