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);
            }];
     
  • 相关阅读:
    mysql8下载安装及配置
    jdk11下载安装及环境变量配置
    展示所有商品案例
    事务(转账实例)
    Part2.7 ESLint
    Part2.6 Webpack
    Part2.5 模块化开发
    Part2.4 gulp 实践
    Part2.3 Grunt
    Part2.2 plop 使用
  • 原文地址:https://www.cnblogs.com/ieso-ios/p/5161085.html
Copyright © 2011-2022 走看看