151 lines
5.3 KiB
Objective-C
151 lines
5.3 KiB
Objective-C
//
|
|
// StartZNPPTYuLanViewController.m
|
|
// ProductApp
|
|
//
|
|
// Created by 工作 on 2024/9/24.
|
|
//
|
|
|
|
#import "StartZNPPTYuLanViewController.h"
|
|
#import "StartZNPPTYuLanTableViewCell.h"
|
|
#import "StartPayViewController.h"
|
|
#import "XLPhotoBrowser.h"
|
|
|
|
@interface StartZNPPTYuLanViewController ()<UITableViewDelegate,UITableViewDataSource>
|
|
///
|
|
@property (nonatomic , strong) UITableView *tableView;
|
|
|
|
@end
|
|
|
|
@implementation StartZNPPTYuLanViewController
|
|
- (UIStatusBarStyle)preferredStatusBarStyle {
|
|
return UIStatusBarStyleDefault;
|
|
}
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|
[super viewWillAppear:animated];
|
|
[self.navigationController setNavigationBarHidden:YES animated:animated];
|
|
[self showNaviGationView:YES];
|
|
[self.navigationView setBackgroundColor:[UIColor whiteColor]];
|
|
}
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
[self.view setBackgroundColor:RGBCOLOR(246, 249, 250)];
|
|
[self.navigationView.backButton setHidden:YES];
|
|
[self drawTopView];
|
|
|
|
UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
|
|
[tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
|
|
[tableView setBackgroundColor:[UIColor clearColor]];
|
|
[tableView setDelegate:self];
|
|
[tableView setDataSource:self];
|
|
[self.view addSubview:tableView];
|
|
[tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.bottom.equalTo(self.view);
|
|
make.top.offset(NavHeight);
|
|
}];
|
|
_tableView = tableView;
|
|
|
|
|
|
}
|
|
-(void)drawTopView
|
|
{
|
|
UILabel *lbname = [[UILabel alloc] init];
|
|
[lbname setText:[NSString stringWithFormat:@"演讲文稿 %ld页",self.modelDetail.result.images.count]];
|
|
[lbname setTextColor:RGBCOLOR(51, 51, 51)];
|
|
[lbname setTextAlignment:NSTextAlignmentLeft];
|
|
[lbname setFont:[UIFont systemFontOfSize:14]];
|
|
[self.navigationView addSubview:lbname];
|
|
[lbname mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.offset(16);
|
|
make.bottom.equalTo(self.navigationView).offset(-12);
|
|
}];
|
|
|
|
NSString *strtt = @"下载PPT";
|
|
float f_width = 79;
|
|
if(self.isyindao)
|
|
{
|
|
strtt = @"生成自己的PPT";
|
|
f_width = 121;
|
|
}
|
|
UIButton *btcreate = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, f_width, 34)];
|
|
[btcreate setTitle:strtt forState:UIControlStateNormal];
|
|
[btcreate setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
[btcreate.titleLabel setFont:[UIFont systemFontOfSize:14]];
|
|
[btcreate.layer setMasksToBounds:YES];
|
|
[btcreate.layer setCornerRadius:17];
|
|
[self.navigationView addSubview:btcreate];
|
|
[btcreate mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.right.equalTo(self.navigationView).offset(-17);
|
|
make.centerY.equalTo(lbname);
|
|
make.size.sizeOffset(CGSizeMake(f_width, 34));
|
|
}];
|
|
[btcreate addTarget:self action:@selector(createAction) forControlEvents:UIControlEventTouchUpInside];
|
|
[Tools changedView:btcreate colors:MainJBColors startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
|
|
}
|
|
|
|
-(void)createAction
|
|
{
|
|
StartPayViewController *vc = [StartPayViewController new];
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
-(void)showImages:(NSInteger)irow
|
|
{
|
|
NSMutableArray *arrtemp = [NSMutableArray new];
|
|
for(ExamplePptDetailModelDataResultImages *model in self.modelDetail.result.images)
|
|
{
|
|
[arrtemp addObject:[Tools isStringnil:model.url]];
|
|
}
|
|
|
|
[XLPhotoBrowser showPhotoBrowserWithImages:arrtemp currentImageIndex:irow].pageControlStyle = XLPhotoBrowserPageControlStyleNone;
|
|
}
|
|
#pragma mark - UITableView
|
|
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
|
{
|
|
return self.modelDetail.result.images.count;
|
|
}
|
|
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
{
|
|
static NSString *strcell = @"StartZNPPTYuLanTableViewCell";
|
|
StartZNPPTYuLanTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell];
|
|
if(!cell)
|
|
{
|
|
cell = [[StartZNPPTYuLanTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strcell];
|
|
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
|
[cell setBackgroundColor:[UIColor clearColor]];
|
|
}
|
|
cell.irow = indexPath.row;
|
|
cell.model = self.modelDetail.result.images[indexPath.row];
|
|
[cell setBackValue:^(NSInteger irow) {
|
|
[self showImages:irow];
|
|
}];
|
|
return cell;
|
|
}
|
|
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
|
{
|
|
return 12;
|
|
}
|
|
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
|
|
{
|
|
return 0.01;
|
|
}
|
|
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
{
|
|
float fheight = (UISCREEN_WIDTH-32)*180/343+35;
|
|
ExamplePptDetailModelDataResultImages *model = self.modelDetail.result.images[indexPath.row];
|
|
fheight+=[Tools getLabelHeightWithText:model.desc width:(UISCREEN_WIDTH - 52) font:12 linHeight:5]+1;
|
|
return fheight;
|
|
}
|
|
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
|
|
{
|
|
return [UIView new];
|
|
}
|
|
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
|
|
{
|
|
return [UIView new];
|
|
}
|
|
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
|
{
|
|
|
|
}
|
|
|
|
@end
|