2013-06-12 31 views

回答

1

我看到有很多答案已經發布。這一個,如果你只想使用CATransition

CATransition *animation = [CATransition animation]; 
[animation setType:kCATransitionMoveIn]; 
[animation setSubtype:kCATransitionFromTop]; 
[animation setDuration:0.6f]; 
[animation setTimingFunction:[CAMediaTimingFunction functionWithName: 
           kCAMediaTimingFunctionEaseInEaseOut]]; 
[subview.layer addAnimation:animation forKey:@"someTransition"]; 
+0

你可以告訴我,我可以通過dismissmodalviewcontroller – hacker

1

試試這個代碼

[self.view bringSubviewToFront:yoursubview]; 
CATransition *animation = [CATransition animation]; 
[animation setType:kCATransitionFade]; 
[animation setDuration:1.00]; 
[animation setTimingFunction:[CAMediaTimingFunction functionWithName: 
           kCAMediaTimingFunctionEaseIn]]; 
[yoursubview.layer addAnimation:animation forKey:@"fadeTransition"]; 

欲瞭解更多信息檢查這些鏈接

  1. Link1
  2. Link2
  3. Link 3

我希望它活像ks給你。

1

更改子視圖的幀INSITE的UIView動畫,像如下,

最初設置的

subView.frame=CGRectMake(0,self.view.frame.size.height,your_width,your_height); 

然後設定動畫

[UIView animateWithDuration:0.25 delay:0 options: UIViewAnimationCurveEaseOut animations:^ { 

     // set subView's frame 

    } completion:^(BOOL finished) { 

    } 
    ]; 
1

嘗試內的所需的幀位置使用UIView動畫塊:

yourView.frame = CGRectMake(0, yourSuperView.frame.size.height, yourView.frame.size.width, yourView.frame.size.height); 
[yourSuperView addSubview:yourView]; 
[UIView animateWithDuration:1.0 animations:^{ 
    yourView.frame = CGRectMake(0, 0, yourView.frame.size.width, yourView.frame.size.height); 
} completion:^(BOOL finished) { 
    //Task to do on Animation completion. 
}]; 

根據您的說服改變動畫持續時間。你也可以使用下列內容:

[UIView animateWithDuration:1.0 animations: { 
     //your Implemntation 
}]; 

[UIView animateWithDuration:1.0 delay:0 options:UIViewAnimationCurveEaseIn animations:^{ 

} completion:^(BOOL finished) { 

}]; 

請檢查UIView class reference動畫選項UIViewAnimationOptions段和方法的細節。

希望這會有幫助