presentModalViewController 的动画效果

系统自带(四种效果):

presentModalViewController模态的动画效果设置:
    

[cpp]  view plain copy
 
  1. UIViewController *detailViewController = [[UIViewController alloc] init];  
  2. detailViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl;    // 设置动画效果  
  3. [self presentModalViewController:detailViewController animated:YES];  
  4. [detailViewController release];  


    共有以下四种动画效果:
    

[cpp]  view plain copy
 
  1. typedef enum {  
  2.      UIModalTransitionStyleCoverVertical = 0,  
  3.      UIModalTransitionStyleFlipHorizontal,  
  4.      UIModalTransitionStyleCrossDissolve,  
  5.   
  6.   
  7.      #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2  
  8.      UIModalTransitionStylePartialCurl,  
  9.      #endif  
  10.  } UIModalTransitionStyle;  


自定义:

 

 

[cpp]  view plain copy
 
  1. <span style="color:#330033;">CATransition *animation = [CATransition animation];  
  2. [animation setDuration:0.5];  
  3. [animation setType:kCATransitionPush];  
  4. [animation setSubtype:kCATransitionFromRight];  
  5. [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];  
  6. [[myViewController.view layer] addAnimation:animation forKey:@"SwitchToView"];    
  7.   
  8.   
  9. [self presentModalViewController:myViewController animated:NO];</span>  

 

你可能感兴趣的:(controller)