zoukankan      html  css  js  c++  java
  • iOS-UIImageView的帧动画

    UIImageView的帧动画
    @property(nonatomic,copy) NSArray *animationImages; // 设置需要播放的图片(到时会按照数组顺序播放)
    @property(nonatomic) NSTimeInterval animationDuration; // 动画的持续时间
    @property(nonatomic) NSInteger animationRepeatCount;  // 动画的执行次数(默认情况下是无限重复执行)
    - (void)startAnimating; // 开始动画
    - (void)stopAnimating;  // 停止动画
    - (BOOL)isAnimating; // 是否正在执行动画
    
    格式符补充
    %03d : 每个整数占据3个位置,多出的位置用0填充
    比如:
    * [NSString stringWithFormat:@"%03d", 0];  返回的是@"000"
    * [NSString stringWithFormat:@"%03d", 7];  返回的是@"007"
    * [NSString stringWithFormat:@"%03d", 15];  返回的是@"015"
    * [NSString stringWithFormat:@"%03d", 134];  返回的是@"134"
    
    加载图片的两种方式
    1.有缓存
    UIImage *image = [UIImage imageNamed:@"a.png"]
    
    2.无缓存
    // 全路径
    NSString *path = [[NSBundle mainBundle] pathForResource:@"a.png" ofType:nil];
    // path是a.png的全路径
    UIImage *image = [[UIImage alloc] initWithContentsOfFile:path]
    
    
    子控件的操作
    1.添加子控件 : addSubview:
    2.从父控件中移除 : removeFromSuperview
    
    动画
    1.头尾式
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1.0];
    // 需要执行动画的代码....
    [UIView commitAnimations];
    
    2.block式
    [UIView animateWithDuration:1.0 animations:^{
        // 需要执行动画的代码....
    } completion:^(BOOL finished) { // 动画执行完毕后会自动调用这个block(这个代码段)
        
    }];
  • 相关阅读:
    iscsi一致性的测试验证方法
    ceph各个版本之间参数变化分析
    rgw的rgw_thread_pool_size配置调整
    rgw前端替换civetweb为beast
    配置内网访问的TV
    关于vm.min_free_kbytes的合理设置推测
    rbd的删除回收站功能
    python爬取微博热门话题榜
    Selenium+Pytest自动化测试框架—禅道实战
    python带参数装饰器的两种写法
  • 原文地址:https://www.cnblogs.com/DarbyCJ/p/3649357.html
Copyright © 2011-2022 走看看