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.

72 lines
2.0 KiB

2 years ago
//
// MenuCollectionViewCell.m
// LekangGuard
//
// Created by ecell on 2022/10/25.
//
#import "MenuCollectionViewCell.h"
@interface MenuCollectionViewCell ()
@property (nonatomic ,weak) UIImageView *iconImg;
@property (nonatomic ,weak) UILabel *titleLabel;
@end
@implementation MenuCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
self.backgroundColor = KKClearColor;
[self subMenuCell];
}
return self;
}
- (void)setTitleStr:(NSString *)titleStr
{
_titleStr = titleStr;
self.titleLabel.text = titleStr;
}
- (void)setImgStr:(NSString *)imgStr
{
_imgStr = imgStr;
self.iconImg.image = ImageName_(imgStr);
}
- (void)subMenuCell
{
UIImage *img = ImageName_(@"icon_home_phone_book");
UIImageView *iconImg = [UICommon ui_imageView:CGRectZero fileName:@""];
self.iconImg = iconImg;
[self.contentView addSubview:iconImg];
[iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentView).offset(Adapted(10));
make.centerX.equalTo(self.contentView);
make.size.mas_equalTo(CGSizeMake(Adapted(img.size.width), Adapted(img.size.height)));
}];
UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(12) textColor:KKTextBlackColor text:@"" Radius:0];
self.titleLabel = titleLabel;
[self.contentView addSubview:titleLabel];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.mas_bottom).inset(Adapted(10));
make.centerX.equalTo(self.contentView);
}];
UILabel *line = [UILabel new];
line.backgroundColor = KKLineColor;
[self.contentView addSubview:line];
[line mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.contentView);
make.bottom.equalTo(self.contentView.mas_bottom);
make.height.mas_equalTo(0.5);
}];
}
@end