用户登录
用户注册

分享至

iOS视图淡入淡出效果

  • 作者: 花开凌乱谁的侧脸
  • 来源: 51数据库
  • 2022-08-17
- (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

软件
前端设计
程序设计
Java相关