2012-03-28 91 views
3

還有比4名的iOS當地人另一個自定義的UIViewController過渡:自定義UIViewController轉換?

typedef enum { 
    UIModalTransitionStyleCoverVertical = 0, 
    UIModalTransitionStyleFlipHorizontal, 
    UIModalTransitionStyleCrossDissolve, 
    UIModalTransitionStylePartialCurl, 
} UIModalTransitionStyle; 

任何提示嗎?

回答

2

您也可以嘗試CATransition,例如,下面的代碼顯示了第二個視圖將當前視圖推送到右側的過渡。 (假設這段代碼放在你的主視圖控制器中)。

UIView *appWindow = [self.view superview]; 

CATransition *animation = [CATransition animation]; 
[animation setDuration:0.3]; 
[animation setType:kCATransitionPush]; 
[animation setSubtype:kCATransitionFromLeft]; 
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; 

[appWindow addSubview:yourSecondViewController.view]; 
[self.view removeFromSuperview]; 

[[appWindow layer] addAnimation:animation forKey:@"showSecondViewController"];