Guest User

Untitled

a guest
Jan 16th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. class HotelAvailableRoomsTVCell: UITableViewCell {
  2.  
  3. @IBOutlet weak var collectionView: UICollectionView!
  4.  
  5. //MARK: Life cycle
  6. override func awakeFromNib() {
  7. super.awakeFromNib()
  8. let nib = UINib.init(nibName: "AvailableRoomCVCell", bundle: nil)
  9. collectionView.register(nib, forCellWithReuseIdentifier: "AvailableRoomCVCell")
  10. collectionView.delegate = self
  11. collectionView.dataSource = self
  12. // Initialization code
  13. }
  14. func initCellWithData(roomJSON:JSON,indexPath:IndexPath,isSingle:Bool) {
  15. DispatchQueue.main.async {
  16. self.collectionView.reloadData()
  17. }
  18.  
  19. }
  20. }
  21.  
  22. In viewController:
  23.  
  24. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  25. let cell = tableView.dequeueReusableCell(withIdentifier: "HotelAvailableRoomsTVCell", for: indexPath) as! HotelAvailableRoomsTVCell
  26. cell.delegate = self
  27. cell.initCellWithData(roomJSON: (json)!, indexPath: indexPath as IndexPath, isSingle: true)
  28. return cell;
  29. }
Add Comment
Please, Sign In to add comment