码迷,mamicode.com
首页 > 移动开发 > 详细

IOS 制作动画代码和 设置控件透明度

时间:2017-02-20 11:32:24      阅读:247      评论:0      收藏:0      [点我收藏+]

标签:动画   btn   view   height   text   ima   line   nim   ios   

方式1:

  //animateWithDuration用1秒钟的时间,执行代码
    [UIView animateWithDuration:1.0 animations:^{
      
        //存放需要执行的动画代码
        self.iconBtn.frame=CGRectMake(83,85,150,150);
        self.cover.alpha=0.0;//设置控件的透明度
    } completion:^(BOOL finished) {
        //动画执行完毕后会自动调用这个block内部的代码
        [self.cover removeFromSuperview];
        self.cover=nil;
    }];

方式2:

  //执行动画代码
   [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(removerCover)];
    
    
    self.iconBtn.frame=CGRectMake(85, 85,150,  150);
    self.cover.alpha=0.0;
    [UIView commitAnimations];
    
    
}

-(void)removerCover
{
        [self.cover removeFromSuperview];
        self.cover=nil;
}

 

IOS 制作动画代码和 设置控件透明度

标签:动画   btn   view   height   text   ima   line   nim   ios   

原文地址:http://www.cnblogs.com/liuwj/p/6418421.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!