简体   繁体   中英

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

}

Try to do this

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
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM