Disclosure indicator to specific cell in static TableView in Swift

前端 未结 4 363
暖寄归人
暖寄归人 2020-12-21 11:42

I created a static TableView and I would like to add or remove a disclosure indicator depending if we are consulting our own account or a guest account.

This is what

4条回答
  •  不思量自难忘°
    2020-12-21 12:00

    Please use below code in cellForRowTableView code

    It will work for you

     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{ 
        if currentUser {
         // Own Account
           cell.accessoryType = .none
           //cell.backgroundColor = UIColor.red
        }else{
         //Guest Account
         cell.accessoryType =.checkmark
        }
    }
    

提交回复
热议问题