VideoDetailViewController.m 3.08 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
//
//  VideoDetailViewController.m
//  Lighting
//
//  Created by 曹云霄 on 2016/11/25.
//  Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//

#import "VideoDetailViewController.h"
#import "VideoDetailIntroTableViewCell.h"
#import "VideoLecturerTableViewCell.h"
12
#import "WkWebViewViewController.h"
13
#import "SpecifiedTableViewCell.h"
14 15 16 17


@interface VideoDetailViewController ()<UITableViewDataSource,UITableViewDelegate>

18

19 20 21 22 23 24 25 26 27 28
@end

@implementation VideoDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setUpTableView];
}

29 30
#pragma mark - 选中学习内容下标
- (void)setIndexPath:(NSIndexPath *)indexPath
31
{
32 33
    _indexPath = indexPath;
    [self.studyItemDetailsTableView reloadData];
34 35
}

36 37
#pragma mark - UITableView
- (void)setUpTableView
38
{
39
    self.studyItemDetailsTableView.tableFooterView = [UIView new];
40 41
}

42 43 44 45 46 47 48
#pragma mark - <UITableViewDelegate,UITableViewDataSource>
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    switch (indexPath.row) {
        case StudyItemIntroCell:
        {
            VideoDetailIntroTableViewCell *itemDetailCell = [tableView dequeueReusableCellWithIdentifier:@"VideoDetailIntroTableViewCell" forIndexPath:indexPath];
49 50
            RsStudyTask *studyEntity = self.datasArray[self.indexPath.section];
            itemDetailCell.studyEntity = studyEntity.studyTasks[self.indexPath.row];
51 52 53 54 55 56
            return itemDetailCell;
        }
            break;
        case LecturerIntroCell:
        {
            VideoLecturerTableViewCell *lectureCell = [tableView dequeueReusableCellWithIdentifier:@"VideoLecturerTableViewCell" forIndexPath:indexPath];
57 58
            RsStudyTask *studyEntity = self.datasArray[self.indexPath.section];
            lectureCell.studyEntity = studyEntity.studyTasks[self.indexPath.row];
59 60 61 62 63
            return lectureCell;
        }
            break;
        case ContraposePersonCell:
        {
64 65 66
            SpecifiedTableViewCell *scopeCell = [tableView dequeueReusableCellWithIdentifier:@"SpecifiedTableViewCell" forIndexPath:indexPath];
            RsStudyTask *studyEntity = self.datasArray[self.indexPath.section];
            scopeCell.studyEntity = studyEntity.studyTasks[self.indexPath.row];
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
            return scopeCell;
        }
            break;
            
        default:
            break;
    }
    return nil;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
84 85
    RsStudyTask *studyEntity = self.datasArray[self.indexPath.section];
    CustomStudyEntity *study = studyEntity.studyTasks[self.indexPath.row];
86 87
    switch (indexPath.row) {
        case StudyItemIntroCell:
88
            return study.contentHeight;
89 90
            break;
        case LecturerIntroCell:
91
            return study.teacherIntroHeight;
92 93
            break;
        case ContraposePersonCell:
94
            return study.personHeight;
95 96 97 98 99
            break;
            
        default:
            break;
    }
100
    return ZERO;
101 102
}

103 104 105 106 107 108 109







110
@end