123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- //
- // YOUPAIMessafeTemplateListCell.m
- // MSYOUPAI
- //
- // Created by admin on 2022/3/11.
- // Copyright © 2022 MS. All rights reserved.
- //
- #import "YOUPAIMessafeTemplateListCell.h"
- @implementation YOUPAIMessafeTemplateListCell
- -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
- if(self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
- [self youpaifMakeUI];
- [self youpaifMakeLayout];
- }
- return self;
- }
- // 标题
- -(UILabel *)youpaiptitleLab{
- if(_youpaiptitleLab == nil){
- _youpaiptitleLab = [UILabel new];
- _youpaiptitleLab.font = LCFont14;
- _youpaiptitleLab.textColor = LZ273145Color;
- }
- return _youpaiptitleLab;
- }
- // 编辑
- -(UIButton *)youpaipeditBtn{
- if(_youpaipeditBtn == nil){
- _youpaipeditBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
- [_youpaipeditBtn setImage:[UIImage imageNamed:@"icon_messagetemplate_edit"] forState:UIControlStateNormal];
- }
- return _youpaipeditBtn;
- }
- // 删除
- -(UIButton *)youpaipdeleteBtn{
- if(_youpaipdeleteBtn == nil){
- _youpaipdeleteBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
- [_youpaipdeleteBtn setImage:[UIImage imageNamed:@"icon_messagetemplate_delete"] forState:UIControlStateNormal];
- }
- return _youpaipdeleteBtn;
- }
- // 选中
- -(UIButton *)youpaipselectBtn{
- if(_youpaipselectBtn == nil){
- _youpaipselectBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 78, 32)];
- [_youpaipselectBtn setImage:[UIImage imageNamed:@"icon_messagetemplate_unselect"] forState:UIControlStateNormal];
- [_youpaipselectBtn setImage:[UIImage imageNamed:@"icon_messagetemplate_select"] forState:UIControlStateSelected];
- _youpaipselectBtn.titleLabel.font = LCFont12;
- [_youpaipselectBtn setTitleColor:LZ273145Color forState:UIControlStateNormal];
- [_youpaipselectBtn setTitle:@"使用此模板" forState:UIControlStateNormal];
-
- }
- return _youpaipselectBtn;
- }
- // 分割线
- -(UIView *)youpaiplineView{
- if(_youpaiplineView == nil){
- _youpaiplineView = [UIView new];
- _youpaiplineView.backgroundColor = LZF5F4F7Color;
- }
- return _youpaiplineView;
- }
- // 文字信息
- -(UILabel *)youpaiptextLab{
- if(_youpaiptextLab == nil){
- _youpaiptextLab = [UILabel new];
- _youpaiptextLab.textColor = LZ273145Color;
- _youpaiptextLab.font = LCFont12;
- }
- return _youpaiptextLab;
- }
- // 图片信息
- -(UIImageView *)youpaipimgView{
- if(_youpaipimgView == nil){
- _youpaipimgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 60, 60)];
- [_youpaipimgView ms_radius:10];
- }
- return _youpaipimgView;
- }
- // 视频信息
- -(UIImageView *)youpaipvideoView{
- if(_youpaipvideoView == nil){
- _youpaipvideoView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 60, 60)];
- [_youpaipvideoView ms_radius:10];
- _youpaipvideoView.contentMode = UIViewContentModeScaleAspectFill;
- }
- return _youpaipvideoView;
- }
- -(UIImageView *)youpaipvideoPlayerView{
- if(_youpaipvideoPlayerView == nil){
- _youpaipvideoPlayerView = [UIImageView new];
- [_youpaipvideoPlayerView ms_radius:10];
- UIImage *img = [UIImage imageNamed:@"icon_messagetemplate_player_samll"];
- _youpaipvideoPlayerView.image = img;
- [_youpaipvideoPlayerView ms_radius:img.size.width/2];
- _youpaipvideoPlayerView.contentMode = UIViewContentModeCenter;
- }
- return _youpaipvideoPlayerView;
- }
- -(UILabel *)youpaipvoideCutDownLab{
- if(_youpaipvoideCutDownLab == nil){
- _youpaipvoideCutDownLab = [UILabel new];
- _youpaipvoideCutDownLab.font = LCFont12;
- _youpaipvoideCutDownLab.textColor = UIColor.whiteColor;
- }
- return _youpaipvoideCutDownLab;
- }
- -(UIImageView *)youpaipvoiceView{
- if(_youpaipvoiceView == nil){
- _youpaipvoiceView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 78, 25)];
- _youpaipvoiceView.image = [UIImage imageNamed:@"icon_messagetemplate_voice"];
-
- }
- return _youpaipvoiceView;
- }
- -(UIStackView *)headerStackView{
- if(_headerStackView == nil){
- _headerStackView = [UIStackView new];
- _headerStackView.spacing = 12;
- }
- return _headerStackView;
- }
- -(UIStackView *)contentStackView{
- if(_contentStackView == nil){
- _contentStackView = [UIStackView new];
- _contentStackView.alignment = UIStackViewAlignmentBottom;
- _contentStackView.spacing = 12;
- }
- return _contentStackView;
- }
- -(UIImageView *)youpaipstateImageView{
- if(_youpaipstateImageView == nil){
- _youpaipstateImageView = [UIImageView new];
- _youpaipstateImageView.image = [UIImage imageNamed:@"icon_messagetemplate_reviewfailure"];
-
- }
- return _youpaipstateImageView;
- }
- -(void)youpaifMakeUI{
- [self setSelectionStyle:UITableViewCellSelectionStyleNone];
- [self.contentView ms_radius:10];
- self.contentView.backgroundColor = UIColor.whiteColor;
- [self.contentView addSubview:self.youpaiptitleLab];
- [self.contentView addSubview:self.headerStackView];
- [self.headerStackView addArrangedSubview:self.youpaipeditBtn];
- [self.headerStackView addArrangedSubview:self.youpaipdeleteBtn];
- [self.headerStackView addArrangedSubview:self.youpaipselectBtn];
- [self.contentView addSubview:self.youpaiplineView];
- [self.contentView addSubview:self.youpaiptitleLab];
- [self.contentView addSubview:self.youpaipstateImageView];
- [self.contentView addSubview:self.youpaiptextLab];
-
-
- [self.contentView addSubview:self.contentStackView];
- [self.contentStackView addArrangedSubview:self.youpaipimgView];
- [self.contentStackView addArrangedSubview:self.youpaipvideoView];
- [self.contentStackView addArrangedSubview:self.youpaipvoiceView];
-
- [self.youpaipvideoView addSubview:self.youpaipvideoPlayerView];
- [self.youpaipvoiceView addSubview:self.youpaipvoideCutDownLab];
-
- }
- -(void)youpaifMakeLayout{
- [_youpaiptitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(12);
- make.top.mas_equalTo(20);
- }];
- [_headerStackView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-12);
- make.centerY.mas_equalTo(self.youpaiptitleLab.mas_centerY);
- make.height.mas_equalTo(14);
- }];
- [_youpaiplineView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(54);
- make.height.mas_equalTo(0.5);
- make.left.mas_equalTo(15);
- make.right.mas_equalTo(-15);
- }];
- [_youpaiptextLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(12);
- make.top.mas_equalTo(self.youpaiplineView).offset(20);
- }];
- [_contentStackView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(12);
- make.height.mas_equalTo(60);
- make.bottom.mas_equalTo(-20);
- }];
- [_youpaipimgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(60);
- }];
- [_youpaipvideoView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(60);
- }];
- [_youpaipstateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-12);
- make.bottom.mas_equalTo(-16);
- }];
- [_youpaipvoideCutDownLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.mas_equalTo(0);
- make.right.mas_equalTo(0).offset(-6);
- }];
-
- [_youpaipvideoPlayerView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.mas_equalTo(0);
- }];
- [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(12);
- make.right.mas_equalTo(-12);
- make.top.mas_equalTo(8);
- make.bottom.mas_equalTo(-1);
- }];
- }
- @end
|