Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/111.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UITableView:奇怪的复选标记附件类型行为_Ios_Swift_Uitableview - Fatal编程技术网

Ios UITableView:奇怪的复选标记附件类型行为

Ios UITableView:奇怪的复选标记附件类型行为,ios,swift,uitableview,Ios,Swift,Uitableview,介绍我的问题的gif: 在myUITableView中,我设置了一个复选标记附件类型,但显示白色背景,而不是单元格的复选标记。复选标记在这里,但为什么我有这个白色背景 我的单元格的染色颜色设置为白色,更改它只需更改复选标记的颜色,背景仍在这里 我的代码: func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if let cell = tableView.cellForRow(at

介绍我的问题的gif:

在my
UITableView
中,我设置了一个复选标记附件类型,但显示白色背景,而不是单元格的复选标记。复选标记在这里,但为什么我有这个白色背景

我的单元格的
染色颜色
设置为
白色
,更改它只需更改复选标记的颜色,背景仍在这里

我的代码:

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    if let cell = tableView.cellForRow(at: indexPath) as? CheckTableViewCell {
        if cell.titleLabel.text != "" {
            cell.accessoryType = .checkmark
        }
    }
}

func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
    tableView.cellForRow(at: indexPath)?.accessoryType = .none
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        if let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as? CheckTableViewCell {
            cell.setUp(withTitle: dataSource[indexPath.row].title)
            return cell
        }
        return CheckTableViewCell()
}

func setUp(withTitle title : String){
    self.titleLabel.text = title
}

有什么想法吗

我必须在情节提要中将
单元格内容的视图
UITableView
背景色设置为粉红色,以使其正常工作。

显示您的
cellForRowAt
方法。