You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
4.2 KiB
125 lines
4.2 KiB
// |
|
// MyTableViewHeaderView.m |
|
// tongxin |
|
// |
|
// Created by ecell on 2023/6/21. |
|
// Copyright © 2023 xTT. All rights reserved. |
|
// |
|
|
|
#import "MyTableViewHeaderView.h" |
|
#import "ModifyDataViewController.h" |
|
|
|
@interface MyTableViewHeaderView () |
|
/// 设备头像 |
|
@property (nonatomic ,weak) UIImageView *iconImg; |
|
|
|
/// 设备名称 |
|
@property (nonatomic ,weak) UILabel *nameLabel; |
|
|
|
@property (nonatomic ,weak) UILabel *idLabel; |
|
|
|
@property (nonatomic ,weak) UILabel *line; |
|
|
|
|
|
@end |
|
|
|
@implementation MyTableViewHeaderView |
|
|
|
- (instancetype)initWithFrame:(CGRect)frame |
|
{ |
|
self = [super initWithFrame:frame]; |
|
if (self) |
|
{ |
|
self.frame = [UIScreen mainScreen].bounds; |
|
[self subHeadView]; |
|
} |
|
return self; |
|
} |
|
|
|
- (void)subHeadView |
|
{ |
|
UIView *bgView = [UICommon ui_imageView:CGRectZero fileName:@"bg_device_info"]; |
|
[self addSubview:bgView]; |
|
[bgView mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.left.right.equalTo(self).inset(10); |
|
make.top.equalTo(self.mas_top).offset(10); |
|
make.height.mas_equalTo(165); |
|
}]; |
|
|
|
/// 设备头像 |
|
UIImageView *iconImg = [UIImageView new]; |
|
iconImg.layer.cornerRadius = 25; |
|
iconImg.layer.masksToBounds = YES; |
|
self.iconImg = iconImg; |
|
[self addSubview:iconImg]; |
|
[iconImg mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.left.equalTo(bgView.mas_left).offset(18); |
|
make.top.equalTo(bgView.mas_top).offset(28); |
|
make.size.mas_equalTo(CGSizeMake(50, 50)); |
|
}]; |
|
|
|
UIButton *btn = [UICommon ui_buttonSimple:CGRectZero font:Font_(0) normalColor:KKClearColor normalText:@"" click:^(id x) { |
|
ModifyDataViewController *vc = [ModifyDataViewController new]; |
|
vc.model = APIManager.sharedManager.userModel; |
|
[[UICommon currentVC].navigationController pushViewController:vc animated:YES]; |
|
}]; |
|
[self addSubview:btn]; |
|
[btn mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.left.right.equalTo(bgView); |
|
make.top.equalTo(bgView); |
|
make.bottom.equalTo(bgView.mas_bottom); |
|
}]; |
|
|
|
|
|
|
|
/// 设备名称 |
|
UILabel *nameLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBold_(20) textColor:KKWhiteColorColor text:@"" Radius:0]; |
|
self.nameLabel = nameLabel; |
|
[self addSubview:nameLabel]; |
|
[nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.left.equalTo(iconImg.mas_right).offset(15); |
|
make.centerY.equalTo(iconImg.mas_centerY); |
|
}]; |
|
|
|
UILabel *idLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(16) textColor:KKTextBlackColor text:@"" Radius:0]; |
|
self.idLabel = idLabel; |
|
[bgView addSubview:idLabel]; |
|
[idLabel mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.left.equalTo(bgView.mas_left).offset(15); |
|
make.bottom.equalTo(bgView.mas_bottom).inset(14); |
|
}]; |
|
|
|
|
|
// /// 右箭头图片 |
|
// UIImageView *rightImg = [UICommon ui_imageView:CGRectZero fileName:@"comm_right_icon"]; |
|
// [bgView addSubview:rightImg]; |
|
// [rightImg mas_makeConstraints:^(MASConstraintMaker *make) { |
|
// make.right.equalTo(bgView.mas_right).inset(36); |
|
// make.centerY.equalTo(iconImg.mas_centerY); |
|
// make.size.mas_equalTo(CGSizeMake(8, 15)); |
|
// }]; |
|
// |
|
UILabel *ttLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(14) textColor:RGB(59, 161, 245) text:@"修改资料" Radius:0]; |
|
[bgView addSubview:ttLabel]; |
|
[ttLabel mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.right.equalTo(bgView.mas_right).inset(15); |
|
make.centerY.equalTo(idLabel.mas_centerY); |
|
}]; |
|
|
|
} |
|
|
|
- (void)seCellModel |
|
{ |
|
[self.iconImg sd_setImageWithURL:[NSURL URLWithString:APIManager.sharedManager.userModel.image] placeholderImage:ImageName_(@"icon_user")]; |
|
self.nameLabel.text = APIManager.sharedManager.userModel.name; |
|
self.idLabel.text = F(@"%@:%@",GJText(@"号码"), APIManager.sharedManager.userModel.phone.length > 0 ? APIManager.sharedManager.userModel.phone : @"--"); |
|
} |
|
/* |
|
// Only override drawRect: if you perform custom drawing. |
|
// An empty implementation adversely affects performance during animation. |
|
- (void)drawRect:(CGRect)rect { |
|
// Drawing code |
|
} |
|
*/ |
|
|
|
@end
|
|
|