繁体   English   中英

添加手势识别器

[英]Add Gesture recognizer

我有两个viewController:FirstViewController和SecondViewController

我制作了一个动画,使视图从右到左。

我想要在向右扫视SecondViewController时隐藏并显示FirstViewController

动画作品中有代码

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];

我添加了一个按钮来隐藏带有动画的视图,但是它不起作用?

  1. 将手势识别器添加到视图中。
  2. 在回调中,弹出视图控制器。

注意:这是非标准的UI。 最好使用标准导航栏和后退按钮。

暂无
暂无

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

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