【发布时间】:2014-11-26 06:24:29
【问题描述】:
我正在尝试将多个子类添加到 UITableView。问题是它一直给我以下错误:
Type UITableVieCell does not conform to protocol NilLiteralConvertible
CellForRowAtIndexPath
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell
cell.textLabel?.text = self.section1[indexPath.row]
cell.accessoryType = .DisclosureIndicator
return cell
} else if indexPath.section == 1 {
let cell = tableView.dequeueReusableCellWithIdentifier("SwitchViewCell", forIndexPath: indexPath) as SwitchViewCell
cell.cellLabel?.text = self.section2[indexPath.row]
return cell
}
return nil
}
【问题讨论】:
标签: ios objective-c iphone uitableview swift