presentModalViewController 的动画效果

转自 http://blog.csdn.net/sirodeng/article/details/8433028

系统自带(四种效果):

presentModalViewController模态的动画效果设置:

 

UIViewController *detailViewController = [[UIViewController alloc] init];  
detailViewController.modalTransitionStyle
= UIModalTransitionStylePartialCurl; // 设置动画效果

[self presentModalViewController:detailViewController animated:YES];
[detailViewController release];

共有四种效果:

    typedef enum {  
         UIModalTransitionStyleCoverVertical = 0,  
         UIModalTransitionStyleFlipHorizontal,  
         UIModalTransitionStyleCrossDissolve,  
         #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2  
         UIModalTransitionStylePartialCurl,  
         #endif  
     } UIModalTransitionStyle;  

自定义:

CATransition *animation = [CATransition animation];  
[animation setDuration:0.5];  
[animation setType:kCATransitionPush];  
[animation setSubtype:kCATransitionFromRight];  
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];  
[[myViewController.view layer] addAnimation:animation forKey:@"SwitchToView"];    
  
[self presentModalViewController:myViewController animated:NO];

 

 

 
posted on 2013-06-18 12:10  罗凇  阅读(304)  评论(0编辑  收藏  举报