0
我有一個viewCell,有幾個不同的子視圖。其中之一是帶有橙色背景的標籤。現在當我在tableview中選擇單元格時,標籤背景閃爍(消失然後重新出現)到它的原始我不能看到是什麼導致此問題。當選擇單元格時,Swift tableView單元格子視圖閃爍(消失然後重新出現)
//my did select func
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
// let selectedCell:UITableViewCell = tableView.cellForRow(at: indexPath)!
tableView.deselectRow(at: indexPath, animated: true)
let post = RquestInfoArray[indexPath.row]
if post["status"] as! String == "pending" {
let ac = UIAlertController(title: "My Rquest", message: "Options", preferredStyle: .actionSheet)
let detailAction = UIAlertAction(title: "View Detail", style: .default, handler: { (action) in
tableView.deselectRow(at: indexPath, animated: false)
print("view detail pressed")
})
let deleteAction = UIAlertAction(title: "Delete", style: .default, handler: { (action) in
tableView.deselectRow(at: indexPath, animated: false)
self.tableView.reloadData()
print("Delete")
})
let cancelAction = UIAlertAction(title: "Cancel", style: .default, handler: { (action) in
tableView.deselectRow(at: indexPath, animated: false)
})
ac.addAction(detailAction)
ac.addAction(deleteAction)
ac.addAction(cancelAction)
self.present(ac, animated: true, completion: nil)
return
}
if post["status"] as! String == "accepted" {
let vc = messageViewController()
let posting = RquestInfoArray[indexPath.row]
let postId = posting["rquestId"] as! String
vc.hidesBottomBarWhenPushed = true
vc.postId = postId
self.navigationController?.pushViewController(vc, animated: true)
}
}