Commit 4ea8f9952a078948b384f2e3ebf1250998b6b285

Authored by “张旭”
1 parent 07f2d4d1

下滑页如果没配置会复用的问题

metaCode/Classes/Main/HomePage/Controller/DownSlideController/CNUpSlideViewController.swift
... ... @@ -121,7 +121,7 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
121 121  
122 122 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
123 123  
124   - if indexPath.row == self.myCurriculumIndex{
  124 + if self.dataArray[indexPath.row] is CNLiveAlbumBaseModel{
125 125 //我的课程cell
126 126 let myCurriculumModel = self.dataArray[indexPath.row] as! CNLiveAlbumBaseModel
127 127 guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideAllCourseCellIdentifier) as? CNDownSlideSingleCourseCell
... ... @@ -132,7 +132,6 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
132 132 cell.myCurriculum = myCurriculumModel
133 133 return cell
134 134 }else{
135   -
136 135 let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel
137 136  
138 137 //type=4一排两个 推荐课程&推荐活动; 74今日推荐; 12列表全部课程; 75单课程大图
... ... @@ -192,8 +191,7 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
192 191  
193 192 func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
194 193 var cellType:CNLiveHomePageCellType = .course
195   -
196   - if indexPath.row == self.myCurriculumIndex{
  194 + if self.dataArray[indexPath.row] is CNLiveAlbumBaseModel{
197 195 //我的课程cell
198 196 let myCurriculumModel = self.dataArray[indexPath.row] as! CNLiveAlbumBaseModel
199 197 cellType = .courseToMyCurriculum
... ... @@ -244,11 +242,10 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
244 242 present(detailVC, animated: true, completion: nil)
245 243 }
246 244 }
247   -
248 245 }
249 246  
250 247 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
251   - if indexPath.row == self.myCurriculumIndex{
  248 + if self.dataArray[indexPath.row] is CNLiveAlbumBaseModel{
252 249 let myCurriculumModel = self.dataArray[indexPath.row] as! CNLiveAlbumBaseModel
253 250 let contentsNum = myCurriculumModel.list.count
254 251 //总显示块数/循环数
... ... @@ -256,12 +253,8 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
256 253 let cellH = DownSlideAllCourseTitleH + DownSlideAllCourseRowH * CGFloat(totalNum)+DownSlideRecommendLeftGap
257 254 return cellH
258 255 }else{
259   - if self.dataArray[indexPath.row] is CNLiveDownSlideModel{
260   - let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel
261   - return CGFloat(slideModel.cellH)
262   - }else{
263   - return 50
264   - }
  256 + let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel
  257 + return CGFloat(slideModel.cellH)
265 258 }
266 259 }
267 260  
... ...
metaCode/Classes/Main/HomePage/View/VerticalViews/DownSlide/CNDownSlideView.swift
... ... @@ -85,9 +85,13 @@ class CNDownSlideView:UIView{
85 85 }
86 86 set{
87 87 _downPath = newValue!
88   -// self.subviews.forEach { view in
89   -// view.removeFromSuperview()
90   -// }//会删除button
  88 + self.subviews.forEach { view in
  89 + if view != bottomView{
  90 + view.removeFromSuperview()
  91 + }else{
  92 +// print("\(view)")
  93 + }
  94 + }//会删除button
91 95  
92 96 if(type == UpDownTypeH5){
93 97 self.addSubview(self.webView)
... ... @@ -111,6 +115,8 @@ class CNDownSlideView:UIView{
111 115 }
112 116 self.addSubview(self.shopConsoleVC.view)
113 117  
  118 + }else{
  119 +
114 120 }
115 121 }
116 122 }
... ...