NetImageView 和 NetImageYYLabel 整理
This commit is contained in:
@@ -14,14 +14,15 @@
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
#import "UIImageView+LoadImage.h"
|
||||
#import "UIImageView+Vague.h"
|
||||
#import "UIImage+ImageEffects.h"
|
||||
///Model
|
||||
#import "UserInfoModel.h"
|
||||
|
||||
#import "NetImageView.h"
|
||||
|
||||
@interface XPMineUserInfoImageCollectionViewCell : UICollectionViewCell
|
||||
///
|
||||
@property (nonatomic,strong) UIImageView *logoImageView;
|
||||
@property (nonatomic,strong) NetImageView *logoImageView;
|
||||
@end
|
||||
|
||||
@implementation XPMineUserInfoImageCollectionViewCell
|
||||
@@ -48,13 +49,14 @@
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIImageView *)logoImageView {
|
||||
- (NetImageView *)logoImageView {
|
||||
if (!_logoImageView) {
|
||||
_logoImageView = [[UIImageView alloc] init];
|
||||
_logoImageView = [[NetImageView alloc] init];
|
||||
_logoImageView.userInteractionEnabled = YES;
|
||||
_logoImageView.layer.masksToBounds = YES;
|
||||
_logoImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_logoImageView.tag = 100000;
|
||||
_logoImageView.imageType = ImageTypeUserInfoAlbum;
|
||||
}
|
||||
return _logoImageView;
|
||||
}
|
||||
@@ -129,15 +131,22 @@
|
||||
}
|
||||
|
||||
- (void)setupCustomCell:(UICollectionViewCell *)cell forIndex:(NSInteger)index cycleScrollView:(SDCycleScrollView *)view {
|
||||
XPMineUserInfoImageCollectionViewCell * imageCell = (XPMineUserInfoImageCollectionViewCell *)cell;
|
||||
NSString *url = [self.imageUrls objectAtIndex:index];
|
||||
@weakify(imageCell);
|
||||
[imageCell.logoImageView load_imageWithUrl:url placeholderImage:[UIImageConstant defalutBannerPlaceholder] type:ImageTypeUserInfoAlbum complection:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
|
||||
@strongify(imageCell);
|
||||
if (image) {
|
||||
[imageCell.logoImageView setImageToBlur:image blurRadius:45];
|
||||
}
|
||||
}];
|
||||
XPMineUserInfoImageCollectionViewCell * imageCell = (XPMineUserInfoImageCollectionViewCell *)cell;
|
||||
NSString *url = [self.imageUrls objectAtIndex:index];
|
||||
@weakify(imageCell);
|
||||
imageCell.logoImageView.imageUrl = url;
|
||||
[imageCell.logoImageView loadImage:imageCell.logoImageView.image completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
|
||||
@strongify(imageCell);
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
UIImage *blurredImage = [image applyBlurWithRadius:45
|
||||
tintColor:nil
|
||||
saturationDeltaFactor:1.8
|
||||
maskImage:nil];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
imageCell.logoImageView.image = blurredImage;
|
||||
});
|
||||
});
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index {
|
||||
|
@@ -12,15 +12,15 @@
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
#import "UIImageView+LoadImage.h"
|
||||
///View
|
||||
#import "XPMineAccountView.h"
|
||||
#import "NetImageView.h"
|
||||
///Model
|
||||
#import "UserInfoModel.h"
|
||||
|
||||
@interface XPMineHeadView ()
|
||||
///头像
|
||||
@property (nonatomic,strong) UIImageView * avatarImageView;
|
||||
@property (nonatomic,strong) NetImageView * avatarImageView;
|
||||
///name的容器
|
||||
@property (nonatomic,strong) UIStackView *nameStackView;
|
||||
///名字
|
||||
@@ -129,7 +129,7 @@
|
||||
if (_userInfo) {
|
||||
self.idLabel.text = [NSString stringWithFormat:@"音游号:%ld", (long)_userInfo.erbanNo];
|
||||
self.nameLabel.text = _userInfo.nick.length > 0 ? _userInfo.nick : @"";
|
||||
[self.avatarImageView load_imageWithUrl:_userInfo.avatar placeholderImage:[UIImageConstant defaultAvatarPlaceholder] type:ImageTypeUserIcon];
|
||||
self.avatarImageView.imageUrl = userInfo.avatar;
|
||||
NSString * sexName;
|
||||
if (userInfo.gender == GenderType_Male) {
|
||||
sexName = @"common_male";
|
||||
@@ -139,12 +139,14 @@
|
||||
self.sexImageView.image = [UIImage imageNamed:sexName];
|
||||
}
|
||||
}
|
||||
- (UIImageView *)avatarImageView {
|
||||
- (NetImageView *)avatarImageView {
|
||||
if (!_avatarImageView) {
|
||||
_avatarImageView = [[UIImageView alloc] init];
|
||||
_avatarImageView = [[NetImageView alloc] init];
|
||||
_avatarImageView.userInteractionEnabled = YES;
|
||||
_avatarImageView.layer.masksToBounds = YES;
|
||||
_avatarImageView.layer.cornerRadius = 25;
|
||||
_avatarImageView.image = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_avatarImageView.imageType = ImageTypeUserIcon;
|
||||
}
|
||||
return _avatarImageView;
|
||||
}
|
||||
|
Reference in New Issue
Block a user