zoukankan      html  css  js  c++  java
  • 图片切换的效果

    图片切换的效果

    效果

    源码

    https://github.com/YouXianMing/Animations

    //
    //  LiveImageView.h
    //  Animations
    //
    //  Created by YouXianMing on 15/12/27.
    //  Copyright © 2015年 YouXianMing. All rights reserved.
    //
    
    #import <UIKit/UIKit.h>
    
    @interface LiveImageView : UIImageView
    
    @property (nonatomic)  CGFloat  duration;
    
    @end
    //
    //  LiveImageView.m
    //  Animations
    //
    //  Created by YouXianMing on 15/12/27.
    //  Copyright © 2015年 YouXianMing. All rights reserved.
    //
    
    #import "LiveImageView.h"
    
    @interface LiveImageView () {
    
        CALayer  *_Layer;
    }
    
    @end
    
    @implementation LiveImageView
    
    - (id)initWithFrame:(CGRect)frame {
        
        if ([super initWithFrame:frame]) {
            
            _duration = 0.3f;
            _Layer    = self.layer;
        }
        
        return self;
    }
    
    @synthesize image = _image;
    
    - (void)setImage:(UIImage *)image {
        
        if (_image != image) {
            
            CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"contents"];
            animation.fromValue         = (__bridge id)(_image.CGImage);
            animation.toValue           =  (__bridge id)(image.CGImage);
            animation.duration          = _duration;
            _Layer.contents             = (__bridge id)(image.CGImage);
            [_Layer addAnimation:animation forKey:nil];
            
            _image = image;
        }
    }
    
    - (UIImage *)image {
        
        return _image;
    }
    
    @end

    细节

  • 相关阅读:
    基础抽象代数
    斜堆
    WC2018
    WC2019
    有向图上不相交路径计数
    生成树计数
    Pr&#252;fer序列
    反演
    1.1 Linux中的进程 --fork、孤儿进程、僵尸进程、文件共享分析
    Python程序的执行过程 解释型语言和编译型语言
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/5080655.html
Copyright © 2011-2022 走看看