207 lines
7.5 KiB
Objective-C
207 lines
7.5 KiB
Objective-C
//
|
|
// FanWenDetailView.m
|
|
// ProductApp
|
|
//
|
|
// Created by 工作 on 2024/10/14.
|
|
//
|
|
|
|
#import "FanWenDetailView.h"
|
|
|
|
|
|
@interface FanWenDetailView ()
|
|
///
|
|
@property (nonatomic , strong) NSMutableArray *arrBtXin;
|
|
|
|
@end
|
|
|
|
@implementation FanWenDetailView
|
|
|
|
-(id)initWithFrame:(CGRect)frame
|
|
{
|
|
if(self = [super initWithFrame:frame])
|
|
{
|
|
UIScrollView *scvback = [[UIScrollView alloc] init];
|
|
[self addSubview:scvback];
|
|
[scvback mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.top.offset(0);
|
|
make.width.equalTo(self);
|
|
make.height.equalTo(self).offset(-TabHeight-20);
|
|
}];
|
|
|
|
UILabel *lbname = [[UILabel alloc] init];
|
|
[lbname setText:@"写给自己"];
|
|
[lbname setTextColor:RGBCOLOR(51, 51, 51)];
|
|
[lbname setTextAlignment:NSTextAlignmentCenter];
|
|
[lbname setFont:[UIFont boldSystemFontOfSize:24]];
|
|
[scvback addSubview:lbname];
|
|
[lbname mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.offset(20);
|
|
make.left.offset(20);
|
|
make.width.equalTo(scvback).offset(-40);
|
|
}];
|
|
|
|
UILabel *lbinfo = [[UILabel alloc] init];
|
|
[lbinfo setText:@"初一丨应用文丨145字"];
|
|
[lbinfo setTextColor:RGBCOLOR(108, 108, 108)];
|
|
[lbinfo setTextAlignment:NSTextAlignmentCenter];
|
|
[lbinfo setFont:[UIFont systemFontOfSize:12]];
|
|
[scvback addSubview:lbinfo];
|
|
[lbinfo mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerX.equalTo(lbname);
|
|
make.top.equalTo(lbname.mas_bottom).offset(15);
|
|
}];
|
|
|
|
UILabel *lbcontent = [[UILabel alloc] init];
|
|
[lbcontent setText:@" 给自己一个微笑,鼓励自己,让自己的自信心恢复原来的样子。给自己一个微笑,失败了可以重来,梦碎了可以重建,但我们不必太自责。给自己一个微笑,让自己坚持把这件事干好,干的比之前更好。"];
|
|
[lbcontent setTextColor:RGBCOLOR(51, 51, 51)];
|
|
[lbcontent setTextAlignment:NSTextAlignmentLeft];
|
|
[lbcontent setFont:[UIFont systemFontOfSize:16]];
|
|
[lbcontent setNumberOfLines:0];
|
|
[scvback addSubview:lbcontent];
|
|
[lbcontent mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.equalTo(lbname);
|
|
make.top.equalTo(lbinfo.mas_bottom).offset(20);
|
|
}];
|
|
|
|
UILabel *lbpf = [[UILabel alloc] init];
|
|
[lbpf setText:@"请给以上内容评分"];
|
|
[lbpf setTextColor:RGBCOLOR(109, 109, 109)];
|
|
[lbpf setTextAlignment:NSTextAlignmentLeft];
|
|
[lbpf setFont:[UIFont systemFontOfSize:14]];
|
|
[scvback addSubview:lbpf];
|
|
[lbpf mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(lbcontent.mas_bottom).offset(40);
|
|
make.centerX.equalTo(lbname);
|
|
}];
|
|
|
|
UIView *viewxin = [[UIView alloc] init];
|
|
[scvback addSubview:viewxin];
|
|
[viewxin mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(lbpf.mas_bottom).offset(10);
|
|
make.height.offset(30);
|
|
make.centerX.equalTo(lbname);
|
|
}];
|
|
[self drawXinView:viewxin];
|
|
|
|
UILabel *lbts = [[UILabel alloc] init];
|
|
[lbts setText:@"请给以上内容评分"];
|
|
[lbts setTextColor:RGBCOLOR(109, 109, 109)];
|
|
[lbts setTextAlignment:NSTextAlignmentLeft];
|
|
[lbts setFont:[UIFont systemFontOfSize:14]];
|
|
[scvback addSubview:lbts];
|
|
[lbts mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(viewxin.mas_bottom).offset(15);
|
|
make.centerX.equalTo(lbname);
|
|
}];
|
|
|
|
[scvback mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.bottom.equalTo(lbts).offset(20);
|
|
}];
|
|
|
|
|
|
UIView *viewbottom = [[UIView alloc] init];
|
|
[viewbottom setBackgroundColor:[UIColor whiteColor]];
|
|
[self addSubview:viewbottom];
|
|
[viewbottom mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.bottom.equalTo(self);
|
|
make.top.equalTo(scvback.mas_bottom);
|
|
}];
|
|
[self drawBottonView:viewbottom];
|
|
|
|
}
|
|
return self;
|
|
}
|
|
-(void)drawXinView:(UIView *)view
|
|
{
|
|
[view mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.offset(40*5);
|
|
}];
|
|
|
|
UIImage *imagexin = [UIImage imageNamed:@"fanwen_xin"];
|
|
UIImage *imagexinN = [Tools imageWithImageName:imagexin imageColor:RGBCOLOR(216, 216, 216)];
|
|
self.arrBtXin = [NSMutableArray new];
|
|
for(int i = 0 ; i < 5; i++)
|
|
{
|
|
UIButton *btxin = [[UIButton alloc] init];
|
|
[btxin setImage:imagexinN forState:UIControlStateNormal];
|
|
[btxin setImage:imagexin forState:UIControlStateSelected];
|
|
[view addSubview:btxin];
|
|
[btxin mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.bottom.equalTo(view);
|
|
make.left.offset(40*i);
|
|
make.width.offset(40);
|
|
}];
|
|
[btxin setTag:i];
|
|
[btxin addTarget:self action:@selector(xinAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
[self.arrBtXin addObject:btxin];
|
|
}
|
|
|
|
}
|
|
-(void)drawBottonView:(UIView *)view
|
|
{
|
|
UIView *viewline = [[UIView alloc] init];
|
|
[viewline setBackgroundColor:RGBCOLOR(238, 238, 238)];
|
|
[view addSubview:viewline];
|
|
[viewline mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.top.equalTo(view);
|
|
make.height.offset(1);
|
|
}];
|
|
|
|
UIButton *btcopy = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH-168, 50)];
|
|
[btcopy setTitle:@"复制全文" forState:UIControlStateNormal];
|
|
[btcopy setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
[btcopy.titleLabel setFont:[UIFont systemFontOfSize:18]];
|
|
[btcopy.layer setMasksToBounds:YES];
|
|
[btcopy.layer setCornerRadius:16];
|
|
[view addSubview:btcopy];
|
|
[btcopy mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.offset(20);
|
|
make.top.offset(10);
|
|
make.height.offset(50);
|
|
make.right.equalTo(view).offset(-148);
|
|
}];
|
|
[btcopy setTag:0];
|
|
[btcopy addTarget:self action:@selector(bottomAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
[Tools changedView:btcopy colors:MainJBColors startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
|
|
|
|
UIButton *btchange = [[UIButton alloc] init];
|
|
[btchange setTitle:@"改写" forState:UIControlStateNormal];
|
|
[btchange setTitleColor:RGBCOLOR(61, 61, 61) forState:UIControlStateNormal];
|
|
[btchange.titleLabel setFont:[UIFont systemFontOfSize:18]];
|
|
[btchange.layer setMasksToBounds:YES];
|
|
[btchange.layer setCornerRadius:16];
|
|
[btchange.layer setBorderWidth:1];
|
|
[btchange.layer setBorderColor:RGBCOLOR(216, 216, 216).CGColor];
|
|
[view addSubview:btchange];
|
|
[btchange mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.equalTo(btcopy.mas_right).offset(20);
|
|
make.top.height.equalTo(btcopy);
|
|
make.right.equalTo(view).offset(-20);
|
|
}];
|
|
[btchange setTag:1];
|
|
[btchange addTarget:self action:@selector(bottomAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
}
|
|
-(void)xinAction:(UIButton *)sender
|
|
{
|
|
for(int i = 0 ; i < self.arrBtXin.count;i++)
|
|
{
|
|
UIButton *bt = self.arrBtXin[i];
|
|
if(i<=sender.tag)
|
|
{
|
|
[bt setSelected:YES];
|
|
}
|
|
else
|
|
{
|
|
[bt setSelected:NO];
|
|
}
|
|
}
|
|
}
|
|
|
|
-(void)bottomAction:(UIButton *)sender
|
|
{
|
|
|
|
}
|
|
|
|
@end
|