developer
2023-05-20 c1ffd99c4b60066774eb2c97b31e4aaa014e7f51
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
//  UIImageView+YTH.m
//  PapayaPlayerDaqo
//
//  Created by 味口 on 15-6-24.
//  Copyright (c) 2015年 wgj. All rights reserved.
//
 
#import "UIImageView+YTH.h"
@implementation UIImageView (YTH)
 
#pragma mark 设置网络图片
- (void)setYthImageWithURL:(NSString *)urlStr placeholderImage:(UIImage *)placeholder{
    if (urlStr.length>4) {
        if ([[urlStr substringWithRange:NSMakeRange(0, 4)] isEqualToString:@"http"]) {
            [self yy_setImageWithURL:[NSURL URLWithString:urlStr] placeholder:placeholder options:YYWebImageOptionProgressiveBlur|YYWebImageOptionSetImageWithFadeAnimation progress:^(NSInteger receivedSize, NSInteger expectedSize) {
                
            } transform:^UIImage * _Nullable(UIImage * _Nonnull image, NSURL * _Nonnull url) {
                return image;
            } completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
                
            }];
        }else{
            [self yy_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",ImageUrl,urlStr]] placeholder:placeholder options:YYWebImageOptionProgressiveBlur|YYWebImageOptionSetImageWithFadeAnimation progress:^(NSInteger receivedSize, NSInteger expectedSize) {
                
            } transform:^UIImage * _Nullable(UIImage * _Nonnull image, NSURL * _Nonnull url) {
                return image;
            } completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
                
            }];
        }
    }
}
 
@end