83 lines
2.4 KiB
Mathematica
83 lines
2.4 KiB
Mathematica
|
|
//
|
||
|
|
// BlackListCell.m
|
||
|
|
// Youth
|
||
|
|
//
|
||
|
|
// Created by mambaxie on 2022/1/2.
|
||
|
|
//
|
||
|
|
|
||
|
|
#import "BlackListCell.h"
|
||
|
|
#import "AvatarView.h"
|
||
|
|
|
||
|
|
@interface BlackListCell ()
|
||
|
|
|
||
|
|
@property (nonatomic, strong) PYThemeButton *removeButton;
|
||
|
|
|
||
|
|
@property (nonatomic, strong) PYImageView *avatarView;
|
||
|
|
|
||
|
|
@property (nonatomic, strong) UILabel *nickNameLabel;
|
||
|
|
|
||
|
|
@property (nonatomic, strong) UIView *lineView;
|
||
|
|
|
||
|
|
@end
|
||
|
|
|
||
|
|
@implementation BlackListCell
|
||
|
|
|
||
|
|
- (void)setupUI {
|
||
|
|
PYImageView *avatarView = [[PYImageView alloc] init];
|
||
|
|
avatarView.size = CGSizeMake(FIX_SIZE(44), FIX_SIZE(44));
|
||
|
|
avatarView.layer.cornerRadius = FIX_SIZE(8);
|
||
|
|
avatarView.clipsToBounds = YES;
|
||
|
|
self.avatarView = avatarView;
|
||
|
|
[self.contentView addSubview:avatarView];
|
||
|
|
|
||
|
|
UILabel *nickNameLabel = [UILabel mt_titleLabelWithText:@""];
|
||
|
|
nickNameLabel.font = MT_FONT_REGULAR_SIZE(13);
|
||
|
|
self.nickNameLabel = nickNameLabel;
|
||
|
|
[self addSubview:nickNameLabel];
|
||
|
|
self.nickNameLabel = nickNameLabel;
|
||
|
|
WeakSelf(self);
|
||
|
|
PYThemeButton *removeButton = [PYThemeButton smallButtonWithTitle:@"移出" action:^(UIButton * _Nonnull button) {
|
||
|
|
if (weakself.removeAction) {
|
||
|
|
weakself.removeAction(weakself.model);
|
||
|
|
}
|
||
|
|
}];
|
||
|
|
removeButton.backgroundColor = COLOR_WITH_RGB(0x4E4F5E);
|
||
|
|
[removeButton setTitleColor:TITLE_COLOR forState:UIControlStateNormal];
|
||
|
|
[self.contentView addSubview:removeButton];
|
||
|
|
self.removeButton = removeButton;
|
||
|
|
|
||
|
|
self.lineView = [UIView new];
|
||
|
|
self.lineView.height = 0.5;
|
||
|
|
self.lineView.width = SCREEN_WIDTH;
|
||
|
|
self.lineView.backgroundColor = LINE_COLOR;
|
||
|
|
[self.contentView addSubview:self.lineView];
|
||
|
|
|
||
|
|
self.contentView.backgroundColor = self.backgroundColor = [UIColor clearColor];
|
||
|
|
}
|
||
|
|
|
||
|
|
- (void)layoutSubviews {
|
||
|
|
[super layoutSubviews];
|
||
|
|
|
||
|
|
self.avatarView.centerY = self.height * 0.5;
|
||
|
|
self.avatarView.x = FIX_SIZE(15);
|
||
|
|
|
||
|
|
self.removeButton.right = self.width - self.avatarView.x;
|
||
|
|
self.removeButton.centerY = self.avatarView.centerY;
|
||
|
|
|
||
|
|
self.nickNameLabel.x = self.avatarView.right + FIX_SIZE(12);
|
||
|
|
self.nickNameLabel.height = self.height;
|
||
|
|
self.nickNameLabel.width = self.removeButton.x - FIX_SIZE(12) - self.nickNameLabel.x;
|
||
|
|
|
||
|
|
self.lineView.x = self.nickNameLabel.x;
|
||
|
|
self.lineView.bottom = self.height;
|
||
|
|
}
|
||
|
|
|
||
|
|
- (void)setModel:(User *)model {
|
||
|
|
[super setModel:model];
|
||
|
|
|
||
|
|
self.avatarView.imageUrl = model.avatar;
|
||
|
|
self.nickNameLabel.text = model.nickname;
|
||
|
|
}
|
||
|
|
|
||
|
|
@end
|