【发布时间】:2016-03-05 16:50:56
【问题描述】:
我将工作 tableviewcontroller 放在 pageviewcontroller 中。现在我必须以编程方式在表格视图中注册单元格,并且不会为单元格调用方法 awakeFromNib。如果我尝试设置内容,我的自定义单元格中的所有属性都未初始化,并且应用程序崩溃。
当我在 pageviewcontroller 中添加 tableviewcontroller 时有什么不同吗?
self.tableView.registerClass(ParticipantCell.self, forCellReuseIdentifier: ParticipantCell.cellIdentifier)
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let index = self.sections[indexPath.section].index+indexPath.row
let participant = self.participants[index]
let cell = tableView.dequeueReusableCellWithIdentifier(ParticipantCell.cellIdentifier, forIndexPath: indexPath) as! ParticipantCell
// cell.setParticipantData(participant)
return cell
}
【问题讨论】:
标签: ios uitableview uipageviewcontroller