iOS视图淡入淡出效果详解手机开发

- (void) fadeOut: (id) sender { 
    CGContextRef context = UIGraphicsGetCurrentContext();  
    [UIView beginAnimations:nil context:context]; 
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];  
    [UIView setAnimationDuration:1.0]; 
    [[self.view viewWithTag:999] setAlpha:0.0f];  
    [UIView commitAnimations];  
    self.navigationItem.rightBarButtonItem = BARBUTTON(@”Fade In”,@selector(fadeIn:)); 
} 
 
- (void) fadeIn: (id) sender { 
    CGContextRef context = UIGraphicsGetCurrentContext();  
    [UIView beginAnimations:nil context:context]; 
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];  
    [UIView setAnimationDuration:1.0]; 
    [[self.view viewWithTag:999] setAlpha:1.0f];  
    [UIView commitAnimations];  
    self.navigationItem.rightBarButtonItem = BARBUTTON(@”Fade Out”,@selector(fadeOut:)); 
} 
 
- (void) viewDidLoad { 
    self.navigationItem.rightBarButtonItem = BARBUTTON(@”Fade Out”,@selector(fadeOut:)); 
}  
 
@end

原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/tech/aiops/3320.html

(0)
上一篇 2021年7月16日 14:28
下一篇 2021年7月16日 14:28

相关推荐

发表回复

登录后才能评论