2011-05-04 28 views
0

嘿,只是想知道如何/如果可能讓UITableView從上到下進行動畫製作。 執行轉換的標準方法將頁面底部設爲頂部,bu我在頁面上有一個撤消按鈕,我想讓用戶點擊,如果他們決定返回...這是我的代碼對於目前的動畫從頭到尾..如果你可以幫助我改變它,那將是非常棒的。如何從上到下創建UINavigationController動畫

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

} 

回答

1
+0

我實際上使用的是你的鏈接問題的代碼:) [self.navigationController dismissModalViewControllerAnimated:YES]; 我剛剛取代了我的undoButton方法和BOYA中的第三行!制定出了不錯的:) – tinhead 2011-05-04 20:28:34

+0

只是爲了勾畫dismissModalViewControllerAnimated:YES是從頂部到底部爲視圖製作動畫。 – tinhead 2011-05-04 20:43:26

+0

@tinhead我沒有意識到你想擺脫屏幕視圖 - 我以爲你真的想改變標準的模態視圖動畫。對於困惑抱歉! – magma 2011-05-05 13:41:46

0

我不頂部認爲底部動畫是有的,但你仍然可以做到這一點的UIView動畫塊。

你應該做的唯一事情就是改變你所展示的視圖的框架。最初將其設置爲像CGRectMake(0,0,320,0)這樣的頂部框架。然後在動畫塊中將框架更改爲CGRectMake(0,0,320,480)。這將使它看起來像從頂部來。當你再次隱藏時,你需要做相反的事情。

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

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

[UIView commitAnimations]; 

希望這有助於!

相關問題