Iphone 如何自上而下创建UINavigationController动画

Iphone 如何自上而下创建UINavigationController动画,iphone,ios,uitableview,uinavigationcontroller,Iphone,Ios,Uitableview,Uinavigationcontroller,嘿,只是想知道如何/如果可能的话获得一个从上到下的UITableView动画。 从下到上转换页面的标准方式,但我在页面上有一个撤销按钮,我想让用户在决定返回时单击该按钮。。。这是我为从下到上的当前动画编写的代码。。如果你能帮我改变,那就太棒了 - (void)viewDidLoad { //Title self.title = @"Advanced Search"; [super viewDidLoad]; //undo button takes

嘿,只是想知道如何/如果可能的话获得一个从上到下的UITableView动画。 从下到上转换页面的标准方式,但我在页面上有一个撤销按钮,我想让用户在决定返回时单击该按钮。。。这是我为从下到上的当前动画编写的代码。。如果你能帮我改变,那就太棒了

  - (void)viewDidLoad { 

    //Title
    self.title = @"Advanced Search";
    [super viewDidLoad];    

    //undo button takes you back to main search options
    UIBarButtonItem *undoButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemUndo target:self action:@selector(undoButton:)];
    self.navigationItem.leftBarButtonItem = undoButton;
}

- (void)undoButton:sender {
    RootViewController *rootViewController = [[RootViewController alloc] init];
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
    [[self navigationController] presentModalViewController:navigationController animated:YES];
    [navigationController release];

}

我不认为自上而下的动画是可用的,但你仍然可以用UIView动画块做到这一点

您应该做的唯一一件事是更改您正在呈现的视图的框架。最初将其设置为顶部框架,如CGRectMake0,0320,0。然后在动画块中,将帧更改为CGRectMake0,0320480。这将使它看起来像来自顶部。当你再次隐藏它时,你需要做相反的事情

[UIView beginAnimations:@"AnimatePresent" context:view];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationDelegate:self];

view.frame = CGRectMake(0, 0 , 320, 480);

[UIView commitAnimations];
希望这有帮助