viewcontroller.swift
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "DetailTableViewCell", for: indexPath as IndexPath) as! DetailTableViewCell
cell.RoomNos.text = RoomGroupArray[indexPath.row].RoomNos
cell.RoomType.text = RoomGroupArray[indexPath.row].RoomCod
cell.RoomCISta.text = RoomGroupArray[indexPath.row].RoomSta
cell.RoomClean.text = RoomGroupArray[indexPath.row].CleanSta
cell.RG = RoomGroupArray[indexPath.row]
return cell
}
tableview Cell.swift
override func awakeFromNib() {
super.awakeFromNib()
collection.backgroundColor = UIColor.clear
collection.register(UINib.init(nibName: "DetailCollectionViewCell", bundle: nil), forCellWithReuseIdentifier: "DetailCollectionViewCell")
collection.delegate = self
collection.dataSource = self
// Initialization code
//RG = A7HFDGV.RoomGroup
print(RG)
}
他print RG出來是nuill 請問要如何把值丟進cell內呢
只要把值準備好(存在RoomGroupArray
即可)
程式會自動把對應的值「丟進cell內」