首页 > 移动平台 > 详细

iOS UIView的简单渐变效果

时间:2016-01-26 18:35:38      阅读:225      评论:0      收藏:0      [点我收藏+]

这里主要用到了ios4.0以后 UIView的类方法 animateWithDuration:

函数原型包括以下类方法

+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations
+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion
+ (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion

参数介绍

duration:动画的持续时间

annimations:动画的实体

completion:annimations执行完后立即执行的代码

options:枚举值,动画执行期间的一些设置

 

下面是可以设置动画效果的属性:

  • frame
  • bounds
  • center
  • transform
  • alpha
  • backgroundColor
  • contentStretch

动画效果的代码块可以有多个属性

[UIView animateWithDuration:0.5 animations:^{
            view.alpha = 0;
            view.frame = CGRectMake(0, 0, 100, 100);
        }];

 

 

iOS UIView的简单渐变效果

原文:http://www.cnblogs.com/ieso-ios/p/5161085.html

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