淡出淡入_移动开发_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > 移动开发 > 淡出淡入

淡出淡入

 2015/3/11 16:17:31  恋雪  程序员俱乐部  我要评论(0)
  • 摘要:-(void)viewDidLoad{[superviewDidLoad];//Doanyadditionalsetupafterloadingtheview,typicallyfromanib.//UIViewUIView*view=[[UIViewalloc]initWithFrame:CGRectMake(10,100,100,200)];view.backgroundColor=[UIColorredColor];[self.viewaddSubview:view]
  • 标签:
class="brush:objc;gutter:true;">- (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];
}

 

  • 相关文章
发表评论
用户名: 匿名