【发布时间】:2016-06-23 21:24:53
【问题描述】:
我在UIViewController 内部有一个UITableView,UIViewController 是delegate 的UITableView。在我的表格视图中,我正在输出具有可变行数的可变数量的部分。 Whenever any cell is selected, a checkmark needs to appear next to it (which is currently working).但是,创建单元格时,特定部分旁边需要复选框。
为了解决这个问题,我有一个包含标题、数据和标志的数组。
这是我的数组,它指定了staticFlag
{arrayOfHeadersAndData.append((/// arrray stuff in a tuple ///,staticFlag: 0))}
这是我添加复选框的方法:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
tableView.cellForRowAtIndexPath(indexPath)?.accessoryType = UITableViewCellAccessoryType.Checkmark
}
这就是我如何尝试在具有staticFlag=0= 的部分上添加一个复选框
if arrayOfHeadersAndData[indexPath.section].staticFlag == 0 {
tableView(tableViewOfCurrentItems, didSelectRowAtIndexPath: indexPath)
}
我目前的错误是
"不能调用非函数类型的值
'UITableView'
【问题讨论】:
标签: ios iphone swift uitableview didselectrowatindexpath