이것이 샘플 코드입니다.
class tableViewClass: UIViewController, UITableViewDelegate, UITableViewDataSource, VideoCellSelectionDelegate {
@IBOutlet weak var tableView: UITableView!
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "VideoCell", for: indexPath) as! VideoCell
cell.delegate = self
return cell
}
func didSelect() {
//performSegue
}
}
는 VideoCell
collectionView 셀이 선택 될 때 호출되는 위임이 있어야합니다
protocol VideoCellSelectionDelegate {
func didSelect()
}
class VideoCell: UITableViewCell, UICollectionViewDelegate {
var delegate: VideoCellSelectionDelegate?
@IBOutlet weak var collectionView: UICollectionView!
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
delegate?.didSelect()
}
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다