123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- //
- // YOUPAILZAvatarView.m
- // VQU
- //
- // Created by CY on 2021/8/17.
- // Copyright © 2021 leo. All rights reserved.
- //
- #import "YOUPAILZAvatarView.h"
- @interface YOUPAILZAvatarView ()
- @property (nonatomic,weak)UIImageView *youpaippersonalityBoxImgV;
- @property (nonatomic,weak,readwrite)UIImageView *youpaipavatarImgV;
- @end
- @implementation YOUPAILZAvatarView
- + (instancetype)youpaifavatarViewWithFrame:(CGRect)frame avatarURL:(NSURL *)avatarURL personalityBoxURL:(NSURL *)personalityBoxURL{
- return [[self alloc] initWithFrame:frame avatarURL:avatarURL personalityBoxURL:personalityBoxURL];
- }
- - (instancetype)initWithFrame:(CGRect)frame avatarURL:(NSURL *)avatarURL personalityBoxURL:(NSURL *)personalityBoxURL{
- if (self = [super initWithFrame:frame]) {
- [self youpaifinitUI];
- self.youpaipavatarURL = avatarURL;
- self.youpaippersonalityBoxURL = personalityBoxURL;
- }
- return self;
- }
- - (void)youpaifinitUI{
- UIImageView *avatarImgV = [[UIImageView alloc] init];
- avatarImgV.contentMode = UIViewContentModeScaleAspectFill;
- avatarImgV.layer.cornerRadius = self.mj_w / 2.0f;
- avatarImgV.clipsToBounds = YES;
- // avatarImgV.layer.borderWidth = 1.0f;
- // avatarImgV.layer.borderColor = HexColorFromRGB(0x4F4B5B).CGColor;
- [self addSubview:avatarImgV];
- self.youpaipavatarImgV = avatarImgV;
- [avatarImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.mas_centerX);
- make.centerY.equalTo(self.mas_centerY);
- make.size.mas_offset(CGSizeMake(self.mj_w, self.mj_h));
- }];
-
-
- UIImageView *personalityBoxImgV = [[UIImageView alloc] init];
- [self addSubview:personalityBoxImgV];
- self.youpaippersonalityBoxImgV = personalityBoxImgV;
- [personalityBoxImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.mas_centerX);
- make.centerY.equalTo(self.mas_centerY);
- make.size.mas_offset(CGSizeMake(self.mj_w / 0.61f, self.mj_h / 0.61f));
- }];
- }
- - (void)setYoupaipavatarURL:(NSURL *)avatarURL{
- _youpaipavatarURL = avatarURL;
- [self.youpaipavatarImgV sd_setImageWithURL:avatarURL];
- }
- - (void)setYoupaippersonalityBoxURL:(NSURL *)personalityBoxURL{
- _youpaippersonalityBoxURL = personalityBoxURL;
- [self.youpaippersonalityBoxImgV sd_setImageWithURL:personalityBoxURL];
- }
- @end
|