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);
            }];
     
  • 相关阅读:
    python 全栈基础作业题
    计算机基础之二:操作系统的发展史
    计算机基础系列之一:计算机硬件概述
    饼图
    折线图
    win_diy_monkey demo
    csv,Excel
    uiautomator2
    win ui自动化测试
    html
  • 原文地址:https://www.cnblogs.com/ieso-ios/p/5161085.html
Copyright © 2011-2022 走看看