[英]I want to Show another Cell on the Selection of “Other” Cell in TableView using Swift 4.2 to 5.1
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let tblContent = tblViewCustomFields[indexPath.row]
let title = tblContent
let custmCell = tableView.dequeueReusableCell(withIdentifier: "Cell") as! CustomCellForLetKnowUs
let customTextCell = tableView.dequeueReusableCell(withIdentifier: "textCell") as! CustomTextCell
custmCell.lblInfo.text = title
if indexPath.row == 7 {
// cellList.append(.withTxtFld)
// tableView.reloadData()
customTextCell.textView.isHidden = true
}
return custmCell
}
嘗試這樣做
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.row == 7 {
let customTextCell = tableView.dequeueReusableCell(withIdentifier: "textCell") as! CustomTextCell
customTextCell.textView.isHidden = true
return customTextCell
}
let custmCell = tableView.dequeueReusableCell(withIdentifier: "Cell") as! CustomCellForLetKnowUs
custmCell.lblInfo.text = tblViewCustomFields[indexPath.row] ?? ""
return custmCell
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.