Commit 1d9667a250df877802e0d1d69aa19a4d68a61f56

Authored by 张旭
1 parent 515d428c

全部课程cell复用 , 没有register全部cell导致; 修改detail X位置

metaCode/Classes/Main/HomePage/Controller/CNUpSlideDetailViewController.swift
@@ -48,7 +48,7 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController { @@ -48,7 +48,7 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController {
48 48
49 lazy var closeBtn: UIButton = { 49 lazy var closeBtn: UIButton = {
50 let btn = UIButton() 50 let btn = UIButton()
51 - btn.frame = CGRect(x: KSreenWidth - 20 - 30, y: 20, width: 30, height: 30) 51 + btn.frame = CGRect(x: KSreenWidth - 20 - 30, y: KStatusBarHeight+20, width: 30, height: 30)
52 btn.setImage(#imageLiteral(resourceName: "close_button"), for: .normal) 52 btn.setImage(#imageLiteral(resourceName: "close_button"), for: .normal)
53 btn.addTarget(self, action: #selector(closeAction), for: .touchUpInside) 53 btn.addTarget(self, action: #selector(closeAction), for: .touchUpInside)
54 return btn 54 return btn
metaCode/Classes/Main/HomePage/Controller/CNUpSlideViewController.swift
@@ -19,9 +19,10 @@ let SlideModelTypeOneCourse75: String = "75"//75单课程大图 @@ -19,9 +19,10 @@ let SlideModelTypeOneCourse75: String = "75"//75单课程大图
19 19
20 class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITableViewDataSource{ 20 class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITableViewDataSource{
21 21
22 - let kCNLiveDownSlideCellIdentifier = "kCNLiveDownSlideCellIdentifier" 22 + let kCNLiveDownSlideAllCourseCellIdentifier = "kCNLiveDownSlideAllCourseCellIdentifier"
23 let kCNLiveDownSlideRecommendCellIdentifier = "kCNLiveDownSlideRecommendCellIdentifier" 23 let kCNLiveDownSlideRecommendCellIdentifier = "kCNLiveDownSlideRecommendCellIdentifier"
24 let kCNLiveDownSlideTodayRecommendCellIdentifier = "kCNLiveDownSlideTodayRecommendCellIdentifier" 24 let kCNLiveDownSlideTodayRecommendCellIdentifier = "kCNLiveDownSlideTodayRecommendCellIdentifier"
  25 + let kCNLiveDownSlideSingleCourseCellIdentifier = "kCNLiveDownSlideSingleCourseCellIdentifier"
25 26
26 var totolNum = 0//一共显示多少行cell 27 var totolNum = 0//一共显示多少行cell
27 28
@@ -73,7 +74,11 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa @@ -73,7 +74,11 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
73 tableView.dataSource = self 74 tableView.dataSource = self
74 tableView.delegate = self 75 tableView.delegate = self
75 tableView.separatorStyle = .none 76 tableView.separatorStyle = .none
76 - tableView.register(CNDownSlideSingleCourseCell.self, forCellReuseIdentifier: kCNLiveDownSlideCellIdentifier) 77 +// tableView.register(CNDownSlideSingleCourseCell.self, forCellReuseIdentifier: kCNLiveDownSlideCellIdentifier)
  78 + tableView.register(CNLiveDownSlideRecommendCell.self, forCellReuseIdentifier: kCNLiveDownSlideRecommendCellIdentifier)
  79 + tableView.register(CNLiveDownSlideTodayRecommendCell.self, forCellReuseIdentifier: kCNLiveDownSlideTodayRecommendCellIdentifier)
  80 + tableView.register(CNDownSlideSingleCourseCell.self, forCellReuseIdentifier: kCNLiveDownSlideAllCourseCellIdentifier)
  81 + tableView.register(CNDownSlideSingleCourseCell.self, forCellReuseIdentifier:kCNLiveDownSlideSingleCourseCellIdentifier)
77 tableView.backgroundColor = HexColor(kCNDownSlideBackgroundColorHex) 82 tableView.backgroundColor = HexColor(kCNDownSlideBackgroundColorHex)
78 return tableView 83 return tableView
79 }() 84 }()
@@ -115,7 +120,7 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa @@ -115,7 +120,7 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
115 cell.slideModel = slideModel 120 cell.slideModel = slideModel
116 return cell 121 return cell
117 }else if slideModel.type == SlideModelTypeAllCourse12{ 122 }else if slideModel.type == SlideModelTypeAllCourse12{
118 - guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideCellIdentifier) as? CNDownSlideSingleCourseCell 123 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideAllCourseCellIdentifier) as? CNDownSlideSingleCourseCell
119 else { 124 else {
120 let cell = CNDownSlideSingleCourseCell() 125 let cell = CNDownSlideSingleCourseCell()
121 cell.slideModel = slideModel 126 cell.slideModel = slideModel
@@ -124,7 +129,7 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa @@ -124,7 +129,7 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
124 cell.slideModel = slideModel 129 cell.slideModel = slideModel
125 return cell 130 return cell
126 }else if slideModel.type == SlideModelTypeOneCourse75{ 131 }else if slideModel.type == SlideModelTypeOneCourse75{
127 - guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideCellIdentifier) as? CNDownSlideSingleCourseCell 132 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideSingleCourseCellIdentifier) as? CNDownSlideSingleCourseCell
128 else { 133 else {
129 let cell = CNDownSlideSingleCourseCell() 134 let cell = CNDownSlideSingleCourseCell()
130 cell.slideModel = slideModel 135 cell.slideModel = slideModel