37 lines
934 B
Objective-C
37 lines
934 B
Objective-C
//
|
|
// NetImageView.h
|
|
// xplan-ios
|
|
//
|
|
// Created by zu on 2021/11/2.
|
|
//
|
|
|
|
#import <UIKit/UIKit.h>
|
|
#import "UIImageConstant.h"
|
|
#import "NetImageConfig.h"
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
typedef void(^LoadCompletion)(UIImage *image, NSURL * url);
|
|
|
|
typedef NS_ENUM(NSInteger, NetImageState){
|
|
NetImageStateUnload = 1,
|
|
NetImageStateLoading,
|
|
NetImageStateLoaded,
|
|
};
|
|
|
|
@interface NetImageView : UIImageView
|
|
|
|
@property (nonatomic, assign, readonly) NetImageState state;
|
|
@property (nonatomic, copy) NSString* imageUrl;
|
|
|
|
- (instancetype)initWithUrl:(NSString * _Nonnull)imageUrl;
|
|
- (instancetype)initWithConfig:(NetImageConfig * _Nullable)config;
|
|
- (instancetype)initWithUrl:(NSString * _Nonnull)imageUrl config:(NetImageConfig * _Nullable)config;
|
|
|
|
- (void)loadImage:(LoadCompletion _Nullable)completion;
|
|
- (void)loadImageWithUrl:(NSString * _Nonnull)imageUrl completion:(LoadCompletion _Nullable)completion;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|