diff --git a/29th_Youtube/29th_Youtube/Sources/HomeVC/Cell/ContentTVC.swift b/29th_Youtube/29th_Youtube/Sources/HomeVC/Cell/ContentTVC.swift index 74d9ba6..140a0d1 100644 --- a/29th_Youtube/29th_Youtube/Sources/HomeVC/Cell/ContentTVC.swift +++ b/29th_Youtube/29th_Youtube/Sources/HomeVC/Cell/ContentTVC.swift @@ -15,6 +15,8 @@ class ContentTVC: UITableViewCell { static let identifier = "ContentTVC" + var presentToDetailViewController: (() -> Void)? + override func awakeFromNib() { super.awakeFromNib() setUI() @@ -28,10 +30,21 @@ class ContentTVC: UITableViewCell { func setUI(){ descriptions.text = "WE SOPT : 조회수 100만회 : 3주 전" descriptions.textColor = .darkGray + let tapGesture: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.handleTap(_:))) + tapGesture.delegate = self + + thumbnail.isUserInteractionEnabled = true + thumbnail.addGestureRecognizer(tapGesture) } func setData(contentData: ContentData) { thumbnail.image = contentData.makeImage() title.text = contentData.contentTitle } + + @objc func handleTap(_ sender: UITapGestureRecognizer? = nil) { + presentToDetailViewController?() + } + } + diff --git a/29th_Youtube/29th_Youtube/Sources/HomeVC/HomeXib/HomeXibVC.swift b/29th_Youtube/29th_Youtube/Sources/HomeVC/HomeXib/HomeXibVC.swift index d540dda..d569298 100644 --- a/29th_Youtube/29th_Youtube/Sources/HomeVC/HomeXib/HomeXibVC.swift +++ b/29th_Youtube/29th_Youtube/Sources/HomeVC/HomeXib/HomeXibVC.swift @@ -122,6 +122,9 @@ extension HomeXibVC: UITableViewDataSource{ guard let cell = tableView.dequeueReusableCell(withIdentifier: ContentTVC.identifier) as? ContentTVC else {return UITableViewCell()} cell.setData(contentData: contentList[indexPath.row]) + cell.presentToDetailViewController = { + // 디테일로 이동 + } return cell } }