首页 > 其他 > 详细

UI:改变UIView背景颜色

时间:2014-12-26 14:36:08      阅读:289      评论:0      收藏:0      [点我收藏+]

//每隔一秒改变一次颜色

    [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(changeColor) userInfo:nil repeats:YES];



#pragma mark 改变颜色


- (void)changeColor{

    //动画开始

    [UIView beginAnimations:nil context:nil];

    [UIView setAnimationDuration:0.5];

    self.view.backgroundColor = [[UIColor alloc]initWithRed:(double)(arc4random()%256)/256 green:(double)(arc4random()%256)/256 blue:(double)(arc4random()%256)/256 alpha:0.5];

    //动画结束

    [UIView commitAnimations];

}


UI:改变UIView背景颜色

原文:http://blog.csdn.net/ytuzhangziyao/article/details/42171401

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!