1

我翻轉到背面的信息視圖。我有它翻轉,我有一個導航欄在另一邊讓我回到原來的視圖回家(這是一個問題,當我試圖使用一種模式)。翻轉視圖控制器僅第一次翻轉

我現在的問題是,它只在第一次使用:我點擊信息按鈕,我翻轉到背面。我點擊後退按鈕,我可以翻轉沒有問題。

但是,如果我再次點擊該信息按鈕,它會推到信息視圖而不是翻轉。翻轉回來仍然很好。如果我離開根視圖並轉到其他地方並返回,它會再次正常翻轉。 在被調用,當我點擊信息按鈕的方法:

InfoViewController *controller = [[[InfoViewController alloc] init] autorelease]; 
[UIView beginAnimations:@"animation" context:nil]; 
[self.navigationController pushViewController: controller animated:NO]; 
[UIView setAnimationDuration:0.8]; 
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO]; 
[UIView commitAnimations]; 

感謝您的幫助!

回答

1

初始化InfoViewController的位置? 因爲每當你來到根它得到初始化和工作正常... 當你點擊它不......很容易修復將寫這個代碼在viewWillAppear ...每次你被調用訪問視圖..

希望這有助於..

+0

謝謝 - 那固定的問題!它不幸提出了另一個,我會分開問。謝謝! – snorkelt 2010-11-04 01:30:03

0

這裏是從較新的UIView的API使用塊,並依賴於ARC有點新的實現。

這是你如何推動新的翻轉屏:

InfoViewController *controller = [[InfoViewController alloc] init]; 
[self.navigationController pushViewController:controller animated:NO]; 


[UIView transitionFromView:self.view 
        toView:controller.view 
        duration:0.8f 
        options:UIViewAnimationOptionTransitionFlipFromLeft 
       completion:^(BOOL finished) { 

    // Add completion stuff here 

}]; 

這裏是貶的片段:

[self.navigationController popViewControllerAnimated:NO]; 

[UIView transitionFromView:controller.view 
        toView:self.view duration:0.8f 
        options:UIViewAnimationOptionTransitionFlipFromRight 
       completion:^(BOOL finished) { 

    // Add completion stuff here 

}];