// // YOUPAILZCardDressHeaderView.m // VQU // // Created by CY on 2021/9/6. // Copyright © 2021 MS. All rights reserved. // #import "YOUPAILZCardDressHeaderView.h" #import "YOUPAILZAvatarView.h" @interface YOUPAILZCardDressHeaderView () @property (nonatomic, weak) UIImageView *youpaipcardDressImgV; @property (nonatomic, weak)YOUPAILZAvatarView *youpaipavatarView; @end @implementation YOUPAILZCardDressHeaderView - (instancetype)initWithFrame:(CGRect)frame{ if (self = [super initWithFrame:frame]) { [self youpaifinitUI]; } return self; } - (void)youpaifinitUI{ UIImageView *bgImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_ic_profile_dress_bg"]]; [self addSubview:bgImgV]; bgImgV.userInteractionEnabled = YES; [bgImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.bottom.right.offset(0.0f); }]; UIImageView *cardDressImgV = [[UIImageView alloc] init]; cardDressImgV.contentMode = UIViewContentModeScaleAspectFit; [self addSubview:cardDressImgV]; self.youpaipcardDressImgV = cardDressImgV; [cardDressImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self); make.centerY.equalTo(self); make.size.mas_offset(CGSizeMake(241.0f, 72.0f)); }]; YOUPAILZAvatarView *avatarView = [YOUPAILZAvatarView youpaifavatarViewWithFrame:CGRectMake(0, 0, 35.0f, 35.0f) avatarURL:[LCTools getImageUrlWithAddress:[LCSaveModel getUserModel].youpaipuserinfo.youpaipavatar] personalityBoxURL:[LCTools getImageUrlWithAddress:[LCSaveModel getUserModel].youpaipuserinfo.youpaipavatar_frame]]; [self addSubview:avatarView]; self.youpaipavatarView = avatarView; [avatarView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(cardDressImgV.mas_top); make.centerX.equalTo(self); make.size.mas_offset(CGSizeMake(35.0f, 35.0f)); }]; // UIImageView *imgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_ic_profile_card"]]; // imgV.contentMode = UIViewContentModeScaleAspectFit; // [self addSubview:imgV]; // [imgV mas_makeConstraints:^(MASConstraintMaker *make) { // make.left.centerY.equalTo(self).offset(10.0f); // make.left.centerX.equalTo(self); // make.size.mas_offset(CGSizeMake(220.0f, 101.0f)); // }]; // UILabel *descL = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 67.0f, 23.0f)]; // descL.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.09f]; // descL.text = @"预览效果"; // descL.textColor = [UIColor whiteColor]; // descL.textAlignment = NSTextAlignmentCenter; // descL.font = LCFont(11.0f); // [LCTools clipCorner:UIRectCornerTopRight|UIRectCornerBottomRight View:descL size:CGSizeMake(11.5f, 11.5f)]; // [self addSubview:descL]; // [descL mas_makeConstraints:^(MASConstraintMaker *make) { // make.left.offset(0.0f); // make.top.offset(17.0f); // make.size.mas_offset(CGSizeMake(67.0f, 23.0f)); // }]; // NSURL *avatarURL = [LCTools getImageUrlWithAddress:[LCSaveModel getUserModel].userinfo.avatar]; // YOUPAILZAvatarView *avatarImgV = [YOUPAILZAvatarView youpaifavatarViewWithFrame:CGRectMake(0.0f, 0.0f, 107.0f, 107.0f) avatarURL:avatarURL personalityBoxURL:[NSURL URLWithString:@""]]; // [self addSubview:avatarImgV]; // self.avatarImgV = avatarImgV; // [avatarImgV mas_makeConstraints:^(MASConstraintMaker *make) { // make.centerX.equalTo(self); // make.centerY.equalTo(self); // make.size.mas_offset(CGSizeMake(107.0f, 107.0f)); // }]; } -(void)youpaifreloadAvatar{ self.youpaipavatarView.youpaipavatarURL = [LCTools getImageUrlWithAddress:[LCSaveModel getUserModel].youpaipuserinfo.youpaipavatar]; self.youpaipavatarView.youpaippersonalityBoxURL = [LCTools getImageUrlWithAddress:[LCSaveModel getUserModel].youpaipuserinfo.youpaipavatar_frame]; } - (void)youpaifreloadWithModel:(YOUPAILZDressModel *)model{ [self.youpaipcardDressImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaippreview_img]]; } @end