你的位置:首页 > 操作系统

[操作系统]淡出淡入

- (void)viewDidLoad {  [super viewDidLoad];  // Do any additional setup after loading the view, typically from a nib.    //UIView  UIView *view=[[UIView alloc]initWithFrame:CGRectMake(10, 100, 100, 200)];  view.backgroundColor=[UIColor redColor];  [self.view addSubview:view];    //淡出  //[self fadeOut:view];    //淡入  //[self fadeIn:view];  }//淡出-(void) fadeOut:(UIView *)view{  CGContextRef context = UIGraphicsGetCurrentContext();  [UIView beginAnimations:nil context:context];  [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];  [UIView setAnimationDuration:0.3];  [view setAlpha:0.0f];  [UIView commitAnimations];}//淡入-(void) fadeIn:(UIView *)view{  CGContextRef context = UIGraphicsGetCurrentContext();  [UIView beginAnimations:nil context:context];  [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];  [UIView setAnimationDuration:0.3];  [view setAlpha:1.0f];  [UIView commitAnimations];}