
- Removed YuMi/Library/ (138 MB, not tracked) - Removed YuMi/Resources/ (23 MB, not tracked) - Removed old version assets (566 files, not tracked) - Excluded Pods/, xcuserdata/ and other build artifacts - Clean repository optimized for company server deployment
161 lines
5.2 KiB
Objective-C
161 lines
5.2 KiB
Objective-C
//
|
||
// YMMomentsSimpleDetailNav.m
|
||
// YUMI
|
||
//
|
||
// Created by XY on 2023/2/22.
|
||
//
|
||
|
||
#import "XPMomentsSimpleDetailNav.h"
|
||
#import "NetImageView.h"
|
||
#import "DJDKMIMOMColor.h"
|
||
#import <Masonry.h>
|
||
#import "MomentsInfoModel.h"
|
||
|
||
@interface XPMomentsSimpleDetailNav()
|
||
/// 返回
|
||
@property (nonatomic, strong) UIButton *backBtn;
|
||
/// 头像
|
||
@property (nonatomic, strong) NetImageView *avatarImageView;
|
||
/// 昵称
|
||
@property (nonatomic, strong) UILabel *nicknameLabel;
|
||
/// ID
|
||
@property (nonatomic, strong) UILabel *idLabel;
|
||
/// 更多
|
||
@property (nonatomic, strong) UIButton *moreBtn;
|
||
|
||
@end
|
||
|
||
@implementation XPMomentsSimpleDetailNav
|
||
|
||
- (instancetype)initWithFrame:(CGRect)frame {
|
||
self = [super initWithFrame:frame];
|
||
if (self) {
|
||
self.backgroundColor = UIColor.whiteColor;
|
||
[self createUI];
|
||
}
|
||
return self;
|
||
}
|
||
|
||
- (void)createUI {
|
||
[self addSubview:self.backBtn];
|
||
[self addSubview:self.avatarImageView];
|
||
[self addSubview:self.nicknameLabel];
|
||
[self addSubview:self.idLabel];
|
||
[self addSubview:self.moreBtn];
|
||
|
||
[self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.leading.mas_equalTo(0);
|
||
make.centerY.mas_equalTo(self);
|
||
make.width.height.mas_equalTo(44);
|
||
}];
|
||
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.leading.mas_equalTo(self.backBtn.mas_trailing);
|
||
make.centerY.mas_equalTo(self);
|
||
make.width.height.mas_equalTo(30);
|
||
}];
|
||
[self.nicknameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.mas_equalTo(self.avatarImageView);
|
||
make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(7);
|
||
make.trailing.lessThanOrEqualTo(self.moreBtn.mas_leading).offset(-10);
|
||
}];
|
||
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.bottom.mas_equalTo(self.avatarImageView);
|
||
make.leading.mas_equalTo(self.nicknameLabel);
|
||
make.trailing.lessThanOrEqualTo(self.moreBtn.mas_leading).offset(-10);
|
||
}];
|
||
[self.moreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.trailing.mas_equalTo(-8);
|
||
make.centerY.mas_equalTo(self);
|
||
make.width.height.mas_equalTo(44);
|
||
}];
|
||
}
|
||
|
||
- (void)setInfoModel:(MomentsInfoModel *)infoModel {
|
||
_infoModel = infoModel;
|
||
if (_infoModel) {
|
||
self.avatarImageView.imageUrl = infoModel.avatar;
|
||
NSString * nick = infoModel.nick;
|
||
self.nicknameLabel.text = nick.length > 0 ? nick : @"";
|
||
self.idLabel.text = [NSString stringWithFormat:@"ID:%@",infoModel.uid];
|
||
}
|
||
}
|
||
|
||
#pragma mark - Action
|
||
/// 返回
|
||
- (void)backBtnAction {
|
||
if (self.delegate && [self.delegate respondsToSelector:@selector(momentsSimpleDetailNavBackAction)]) {
|
||
[self.delegate momentsSimpleDetailNavBackAction];
|
||
}
|
||
}
|
||
|
||
/// 点击头像
|
||
- (void)didTapAvatarGuest {
|
||
if (self.delegate && [self.delegate respondsToSelector:@selector(momentsSimpleDetailNavAvatarAction)]) {
|
||
[self.delegate momentsSimpleDetailNavAvatarAction];
|
||
}
|
||
}
|
||
|
||
/// 点击更多
|
||
- (void)moreBtnAction {
|
||
if (self.delegate && [self.delegate respondsToSelector:@selector(momentsSimpleDetailNavMoreAction)]) {
|
||
[self.delegate momentsSimpleDetailNavMoreAction];
|
||
}
|
||
}
|
||
|
||
#pragma mark - 懒加载
|
||
|
||
- (UIButton *)backBtn {
|
||
if (!_backBtn) {
|
||
_backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||
[_backBtn setImage:[[UIImage imageNamed:@"common_nav_back"]ms_SetImageForRTL] forState:UIControlStateNormal];
|
||
[_backBtn addTarget:self action:@selector(backBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||
}
|
||
return _backBtn;
|
||
}
|
||
|
||
- (NetImageView *)avatarImageView {
|
||
if (!_avatarImageView) {
|
||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||
config.imageType = ImageTypeUserIcon;
|
||
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||
_avatarImageView.userInteractionEnabled = YES;
|
||
_avatarImageView.layer.masksToBounds = YES;
|
||
_avatarImageView.layer.cornerRadius = 30/2;
|
||
_avatarImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapAvatarGuest)];
|
||
[_avatarImageView addGestureRecognizer:tap];
|
||
}
|
||
return _avatarImageView;
|
||
}
|
||
|
||
- (UILabel *)nicknameLabel {
|
||
if (!_nicknameLabel) {
|
||
_nicknameLabel = [[UILabel alloc] init];
|
||
_nicknameLabel.textColor = [DJDKMIMOMColor mainTextColor];
|
||
_nicknameLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
|
||
}
|
||
return _nicknameLabel;
|
||
}
|
||
|
||
- (UILabel *)idLabel {
|
||
if (!_idLabel) {
|
||
_idLabel = [[UILabel alloc] init];
|
||
_idLabel.textColor = [DJDKMIMOMColor textThirdColor];
|
||
_idLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightRegular];
|
||
}
|
||
return _idLabel;
|
||
}
|
||
|
||
- (UIButton *)moreBtn {
|
||
if (!_moreBtn) {
|
||
_moreBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||
[_moreBtn setImage:[UIImage imageNamed:@"monents_info_like_report"] forState:UIControlStateNormal];
|
||
[_moreBtn addTarget:self action:@selector(moreBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||
}
|
||
return _moreBtn;
|
||
}
|
||
|
||
|
||
@end
|