0

我有两个 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];

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

4

1 回答 1

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

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

于 2013-02-14T15:27:49.103 回答