小编Chr*_*ell的帖子

Swift 3 tableView没有在reloadData()上更新

我正在构建一个主细节应用程序.我有一个部分视图控制器(VC),它是主VC的子代.单击VC部分中的行会显示用户完成所需信息的不同详细信息VC.一旦详细VC中的信息完成,我希望在VC行的相关部分中显示复选标记.FYI selectedProject是核心数据对象.

我在详细VC viewWillDisappear中调用通知来刷新VC部分.

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
    let detailCase: String = selectedProject!.section![indexPath.row]
    configureCell(cell, withSectionName: detailCase)
    print("location complete is \(selectedProject!.completeLocation)")
    print("electricity complete is \(selectedProject!.completeElectricity)"
    print(cell.textLabel!.text!)
    print(cell.accessoryType.rawValue)
    return cell
}

func configureCell(_ cell: UITableViewCell, withSectionName sectionName: String) {
        switch sectionName {
        case "Project Details" :
            cell.accessoryType = .checkmark
        case "Location" :
            if selectedProject?.completeLocation == true {
                cell.accessoryType = .checkmark
            }
        case "Electricity Use" :
            if selectedProject?.completeElectricity == …
Run Code Online (Sandbox Code Playgroud)

xcode uitableview checkmark ios swift

3
推荐指数
1
解决办法
5503
查看次数

标签 统计

checkmark ×1

ios ×1

swift ×1

uitableview ×1

xcode ×1