1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//
// VideoDetailViewController.m
// Lighting
//
// Created by 曹云霄 on 2016/11/25.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "VideoDetailViewController.h"
#import "VideoDetailIntroTableViewCell.h"
#import "VideoLecturerTableViewCell.h"
#import "WkWebViewViewController.h"
#import "SpecifiedTableViewCell.h"
@interface VideoDetailViewController ()<UITableViewDataSource,UITableViewDelegate>
@end
@implementation VideoDetailViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self setUpTableView];
}
#pragma mark - 选中学习内容下标
- (void)setIndexPath:(NSIndexPath *)indexPath
{
_indexPath = indexPath;
[self.studyItemDetailsTableView reloadData];
}
#pragma mark - UITableView
- (void)setUpTableView
{
self.studyItemDetailsTableView.tableFooterView = [UIView new];
}
#pragma mark - <UITableViewDelegate,UITableViewDataSource>
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
switch (indexPath.row) {
case StudyItemIntroCell:
{
VideoDetailIntroTableViewCell *itemDetailCell = [tableView dequeueReusableCellWithIdentifier:@"VideoDetailIntroTableViewCell" forIndexPath:indexPath];
RsStudyTask *studyEntity = self.datasArray[self.indexPath.section];
itemDetailCell.studyEntity = studyEntity.studyTasks[self.indexPath.row];
return itemDetailCell;
}
break;
case LecturerIntroCell:
{
VideoLecturerTableViewCell *lectureCell = [tableView dequeueReusableCellWithIdentifier:@"VideoLecturerTableViewCell" forIndexPath:indexPath];
RsStudyTask *studyEntity = self.datasArray[self.indexPath.section];
lectureCell.studyEntity = studyEntity.studyTasks[self.indexPath.row];
return lectureCell;
}
break;
case ContraposePersonCell:
{
SpecifiedTableViewCell *scopeCell = [tableView dequeueReusableCellWithIdentifier:@"SpecifiedTableViewCell" forIndexPath:indexPath];
RsStudyTask *studyEntity = self.datasArray[self.indexPath.section];
scopeCell.studyEntity = studyEntity.studyTasks[self.indexPath.row];
return scopeCell;
}
break;
default:
break;
}
return nil;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 3;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
RsStudyTask *studyEntity = self.datasArray[self.indexPath.section];
CustomStudyEntity *study = studyEntity.studyTasks[self.indexPath.row];
switch (indexPath.row) {
case StudyItemIntroCell:
return study.contentHeight;
break;
case LecturerIntroCell:
return study.teacherIntroHeight;
break;
case ContraposePersonCell:
return 100;
break;
default:
break;
}
return 0;
}
@end