Commit 9059b233868b125f0e45cec653bf1874ecc80af6
1 parent
dc564c43
解决 短剧大图cell点击crash问题
Showing
3 changed files
with
24 additions
and
14 deletions
metaCode/Classes/Main/HomePage/Controller/DownSlideController/CNSlideBaseNavigationController.swift
| @@ -17,6 +17,9 @@ class CNSlideBaseNavigationController: UINavigationController | @@ -17,6 +17,9 @@ class CNSlideBaseNavigationController: UINavigationController | ||
| 17 | self.cellType = cellType | 17 | self.cellType = cellType |
| 18 | 18 | ||
| 19 | } | 19 | } |
| 20 | + override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { | ||
| 21 | + super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) | ||
| 22 | + } | ||
| 20 | 23 | ||
| 21 | required init?(coder aDecoder: NSCoder) { | 24 | required init?(coder aDecoder: NSCoder) { |
| 22 | fatalError("init(coder:) has not been implemented") | 25 | fatalError("init(coder:) has not been implemented") |
metaCode/Classes/Main/HomePages/Controller/AuthController/CNLiveAuthViewController.swift
| @@ -246,7 +246,8 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | @@ -246,7 +246,8 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | ||
| 246 | }else if slideModel.type == SlideModelTypeOneCourse75{ | 246 | }else if slideModel.type == SlideModelTypeOneCourse75{ |
| 247 | guard let cell = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return } | 247 | guard let cell = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return } |
| 248 | selectedCell = cell | 248 | selectedCell = cell |
| 249 | - let detailVC = CNSlideBaseNavigationController(rootViewController: CNUpSlideDetailViewController(cell: cell,slideModel: slideModel, cellType: cellType), cellType: cellType) | 249 | + let detailViewC = CNUpSlideDetailViewController(cell: cell,slideModel: slideModel, cellType: cellType) |
| 250 | + let detailVC = CNSlideBaseNavigationController(rootViewController: detailViewC, cellType: cellType) | ||
| 250 | 251 | ||
| 251 | detailVC.dismissClosure = { [weak self] in | 252 | detailVC.dismissClosure = { [weak self] in |
| 252 | guard let StrongSelf = self else { return } | 253 | guard let StrongSelf = self else { return } |
metaCode/Classes/Main/Util/CNUpSlideAnimationTransition.swift
| @@ -203,20 +203,26 @@ extension CNUpSlideAnimationTransition: UIViewControllerAnimatedTransitioning { | @@ -203,20 +203,26 @@ extension CNUpSlideAnimationTransition: UIViewControllerAnimatedTransitioning { | ||
| 203 | let toVCNav = toVCTabbar.viewControllers?.first as! CNLiveBaseNavigationController | 203 | let toVCNav = toVCTabbar.viewControllers?.first as! CNLiveBaseNavigationController |
| 204 | let toVC = toVCNav.viewControllers.first as! CNLiveAuthViewController | 204 | let toVC = toVCNav.viewControllers.first as! CNLiveAuthViewController |
| 205 | guard let selectedCell = toVC.selectedCell else { return } | 205 | guard let selectedCell = toVC.selectedCell else { return } |
| 206 | - let fromVC = fromNaviVC.topViewController as! CNUpSlideDetailViewController | ||
| 207 | - | ||
| 208 | - UIView.animate(withDuration: transitonDuration - 0.3, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0, options: [], animations: { | ||
| 209 | - let frame = selectedCell.convert(selectedCell.bgBackView.frame, to: toVC.view) | ||
| 210 | - fromVC.view.frame = frame | ||
| 211 | - fromVC.view.layer.cornerRadius = GlobalConstants.toDayCardCornerRadius | ||
| 212 | - fromVC.scrollView.imageView.frame.size.width = GlobalConstants.todayCardSize.width | ||
| 213 | - fromVC.scrollView.imageView.frame.size.height = GlobalConstants.todayCardSize.height | ||
| 214 | - fromVC.closeBtn.alpha = 0 | ||
| 215 | - | ||
| 216 | - }) { (completed) in | ||
| 217 | - transitionContext.completeTransition(completed) | 206 | + if fromNaviVC.topViewController is CNUpSlideDetailViewController{ |
| 207 | + let fromVC = fromNaviVC.topViewController as! CNUpSlideDetailViewController | ||
| 208 | + UIView.animate(withDuration: transitonDuration - 0.3, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0, options: [], animations: { | ||
| 209 | + let frame = selectedCell.convert(selectedCell.bgBackView.frame, to: toVC.view) | ||
| 210 | + fromVC.view.frame = frame | ||
| 211 | + fromVC.view.layer.cornerRadius = GlobalConstants.toDayCardCornerRadius | ||
| 212 | + fromVC.scrollView.imageView.frame.size.width = GlobalConstants.todayCardSize.width | ||
| 213 | + fromVC.scrollView.imageView.frame.size.height = GlobalConstants.todayCardSize.height | ||
| 214 | + fromVC.closeBtn.alpha = 0 | ||
| 215 | + | ||
| 216 | + }) { (completed) in | ||
| 217 | + transitionContext.completeTransition(completed) | ||
| 218 | + } | ||
| 219 | + }else if fromNaviVC.topViewController is CNLiveShortVideoViewController{ | ||
| 220 | + let fromVC = fromNaviVC.topViewController as! CNLiveShortVideoViewController | ||
| 221 | + transitionContext.completeTransition(true) | ||
| 222 | + }else{ | ||
| 223 | + print("") | ||
| 218 | } | 224 | } |
| 219 | - | 225 | + |
| 220 | } | 226 | } |
| 221 | 227 | ||
| 222 | } | 228 | } |