jiGuangXieZuo/ProductApp/ProductApp/ProductMain/首页/cell/老师/ShouYeLSZWPGTableViewCell.m

122 lines
4.4 KiB
Objective-C

//
// ShouYeLSZWPGTableViewCell.m
// ProductApp
//
// Created by 工作 on 2024/9/26.
//
#import "ShouYeLSZWPGTableViewCell.h"
#import <libpag/PAGView.h>
#import "CamreViewController.h"
@interface ShouYeLSZWPGTableViewCell ()
///
@property (nonatomic , strong) PAGView *pagView;
@end
@implementation ShouYeLSZWPGTableViewCell
-(void)dealloc
{
[self.pagView stop];
[self.pagView freeCache];
}
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
{
UIImageView *viewback = [[UIImageView alloc] init];
[viewback setBackgroundColor:[UIColor whiteColor]];
[self.contentView addSubview:viewback];
[viewback mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
[viewback setUserInteractionEnabled:YES];
[viewback.layer setMasksToBounds:YES];
[viewback.layer setCornerRadius:8];
[viewback setImage:[UIImage imageNamed:@"home_ls_zwpg"]];
UILabel *lbname = [[UILabel alloc] init];
[lbname setText:@"作文批改"];
[lbname setTextColor:RGBCOLOR(26, 26, 26)];
[lbname setTextAlignment:NSTextAlignmentLeft];
[lbname setFont:[UIFont fontWithName:@"AlimamaShuHeiTi-Bold" size:24]];
[viewback addSubview:lbname];
[lbname mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.offset(29);
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]];
[viewback addSubview:lbinfo];
[lbinfo mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(lbname);
make.top.equalTo(lbname.mas_bottom).offset(4);
}];
UIButton *btsy = [[UIButton alloc] init];
[btsy setTitle:@"立即使用" forState:UIControlStateNormal];
[btsy setTitleColor:RGBCOLOR(27, 123, 103) forState:UIControlStateNormal];
[btsy.titleLabel setFont:[UIFont systemFontOfSize:16]];
[btsy setBackgroundImage:[UIImage imageNamed:@"home_ls_bt"] forState:UIControlStateNormal];
[viewback addSubview:btsy];
[btsy mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.offset(26);
make.size.sizeOffset(CGSizeMake(102, 33));
make.top.equalTo(lbinfo.mas_bottom).offset(15);
}];
[btsy setUserInteractionEnabled:NO];
UILabel *lbts = [[UILabel alloc] init];
[lbts setText:@"100万+正在使用"];
[lbts setTextColor:RGBCOLOR(11, 142, 147)];
[lbts setTextAlignment:NSTextAlignmentLeft];
[lbts setFont:[UIFont systemFontOfSize:14]];
[viewback addSubview:lbts];
[lbts mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.offset(11);
make.right.equalTo(viewback).offset(-18);
}];
PAGView *pagView = [[PAGView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH-32, 140)];
[viewback addSubview:pagView];
dispatch_async(dispatch_get_global_queue(0, 0), ^{
NSString *strpath = [[NSBundle mainBundle] pathForResource:@"分数" ofType:@"pag"];
PAGFile* pagFile = [PAGFile Load:strpath];
[pagView setComposition:pagFile];
[pagView setRepeatCount:0];
dispatch_async(dispatch_get_main_queue(), ^{
[pagView play];
});
});
[pagView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(viewback);
}];
_pagView = pagView;
UIButton *btnext = [[UIButton alloc] init];
[viewback addSubview:btnext];
[btnext mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(viewback);
}];
[btnext addTarget:self action:@selector(nextAction) forControlEvents:UIControlEventTouchUpInside];
}
return self;
}
-(void)nextAction
{
CamreViewController *vc = [CamreViewController new];
vc.type = 1;
[self.viewController.navigationController pushViewController:vc animated:YES];
[UserInfoModel shijianShangBao:0 key:@"client.jump.to.camera" value:@"correct" extra:@""];
}
@end