jiGuangXieZuo/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeXieZuoTableViewCell.m

151 lines
5.3 KiB
Objective-C

//
// ShouYeXieZuoTableViewCell.m
// ProductApp
// 拍照写作 课堂写作 作文批改
// Created by 工作 on 2024/9/26.
//
#import "ShouYeXieZuoTableViewCell.h"
#import "CamreViewController.h"
@interface ShouYeXieZuoTableViewCell ()
@end
@implementation ShouYeXieZuoTableViewCell
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
{
UIView *viewback = [[UIView alloc] init];
[self.contentView addSubview:viewback];
[viewback mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
UIView *viewpz = [[UIView alloc] init];
[viewpz setBackgroundColor:[UIColor whiteColor]];
[viewback addSubview:viewpz];
[viewpz mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.bottom.equalTo(viewback);
make.width.offset((UISCREEN_WIDTH-42)/2.0);
}];
[self drawPZView:viewpz];
UIView *viewkt = [[UIView alloc] init];
[viewkt setBackgroundColor:[UIColor whiteColor]];
[viewback addSubview:viewkt];
[viewkt mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(viewpz.mas_right).offset(10);
make.top.right.equalTo(viewback);
make.height.offset(75);
}];
[self drawSmillView:viewkt title:@"课堂写作" info:@"提升能力" img:@"home_ketangback" tag:1];
UIView *viewpg = [[UIView alloc] init];
[viewpg setBackgroundColor:[UIColor whiteColor]];
[viewback addSubview:viewpg];
[viewpg mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.height.equalTo(viewkt);
make.top.equalTo(viewkt.mas_bottom).offset(10);
}];
[self drawSmillView:viewpg title:@"作文批改" info:@"严谨老师" img:@"home_pigaiback" tag:2];
}
return self;
}
-(void)drawSmillView:(UIView *)view title:(NSString *)title info:(NSString *)info img:(NSString *)img tag:(int)tag
{
[view.layer setMasksToBounds:YES];
[view.layer setCornerRadius:8];
UIImageView *imgvback = [[UIImageView alloc] init];
[imgvback setImage:[UIImage imageNamed:img]];
[imgvback setContentMode:UIViewContentModeBottomRight];
[view addSubview:imgvback];
[imgvback mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(view);
}];
UILabel *lbname = [[UILabel alloc] init];
[lbname setText:title];
[lbname setTextColor:RGBCOLOR(26, 26, 26)];
[lbname setTextAlignment:NSTextAlignmentLeft];
[lbname setFont:[UIFont fontWithName:@"AlimamaShuHeiTi-Bold" size:20]];
[view addSubview:lbname];
[lbname mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.offset(13);
make.top.offset(13);
}];
UILabel *lbinfo = [[UILabel alloc] init];
[lbinfo setText:info];
[lbinfo setTextColor:RGBCOLOR(102, 102, 102)];
[lbinfo setTextAlignment:NSTextAlignmentLeft];
[lbinfo setFont:[UIFont systemFontOfSize:14]];
[view addSubview:lbinfo];
[lbinfo mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(lbname);
make.top.equalTo(lbname.mas_bottom).offset(4);
}];
UIButton *btaction = [[UIButton alloc] init];
[view addSubview:btaction];
[btaction mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(view);
}];
[btaction setTag:tag];
[btaction addTarget:self action:@selector(btAction:) forControlEvents:UIControlEventTouchUpInside];
}
-(void)drawPZView:(UIView *)view
{
[view.layer setMasksToBounds:YES];
[view.layer setCornerRadius:8];
UIImageView *imgvback = [[UIImageView alloc] init];
[imgvback setImage:[UIImage imageNamed:@"home_pzback"]];
[imgvback setContentMode:UIViewContentModeBottomRight];
[view addSubview:imgvback];
[imgvback mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(view);
}];
UILabel *lbname = [[UILabel alloc] init];
[lbname setText:@"拍照写作"];
[lbname setTextColor:RGBCOLOR(26, 26, 26)];
[lbname setTextAlignment:NSTextAlignmentLeft];
[lbname setFont:[UIFont fontWithName:@"AlimamaShuHeiTi-Bold" size:24]];
[view addSubview:lbname];
[lbname mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.offset(16);
make.top.offset(20);
}];
UILabel *lbinfo = [[UILabel alloc] init];
[lbinfo setText:@"破壁作家"];
[lbinfo setTextColor:RGBCOLOR(102, 102, 102)];
[lbinfo setTextAlignment:NSTextAlignmentLeft];
[lbinfo setFont:[UIFont systemFontOfSize:14]];
[view addSubview:lbinfo];
[lbinfo mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(lbname);
make.top.equalTo(lbname.mas_bottom).offset(4);
}];
UIButton *btaction = [[UIButton alloc] init];
[view addSubview:btaction];
[btaction mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(view);
}];
[btaction setTag:0];
[btaction addTarget:self action:@selector(btAction:) forControlEvents:UIControlEventTouchUpInside];
}
-(void)btAction:(UIButton *)sender
{
CamreViewController *vc = [CamreViewController new];
[self.viewController.navigationController pushViewController:vc animated:YES];
}
@end