zoukankan      html  css  js  c++  java
  • iOS UIView的简单渐变效果

    这里主要用到了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);
            }];
     
  • 相关阅读:
    第一篇随笔
    我的第一篇博客
    第一次博客
    芜湖
    芜湖~
    起飞
    第一天
    第一篇随笔
    第一篇随笔
    随笔
  • 原文地址:https://www.cnblogs.com/ieso-ios/p/5161085.html
Copyright © 2011-2022 走看看