2012-05-18 57 views
0

我需要從相同視圖控制器的3個視圖切換。我正確地達到了它,但我總是得到一個淡入淡出的過渡。我不明白如何工作。哪個參數定義了轉換的類型? setType或圖層forKey:?我嘗試了兩種,但我總是得到相同的效果!謝謝使用塊的iOS視圖轉換

CATransition *trans =[CATransition animation]; 
      trans.delegate = self; 
      [trans setDuration:2]; 
      [trans setType:kCATransitionFromTop]; 
      [trans setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]]; 

     CALayer *layer = self.view.layer; 

     [layer addAnimation:trans forKey:kCATransitionMoveIn]; 

     [self.view addSubview:vistaSocial]; 

回答