我的代码仍然可以在iOS8中完美运行,但在iOS9中,单元格在cellForRowAtIndexPath
返回UITableViewCell O.o之前以某种方式构建。
// in my TableView.swift file:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
// It seems the cell.swift file is run here, breaking at layoutSubViews (below)
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! QSMyCellNEW
cell.delegate = self
cell.QJoinObject = myQJoinObjects[indexPath.row] as! PFObject
print(cell.QJoinObject) // all data present
return cell
}
// in my tableViewCell.swift file:
class QSMyCellNEW: UITableViewCell {
var QJoinObject: PFObject!
}
.
.
.
override func layoutSubviews() {
super.layoutSubviews()
print(QJoinObject) // breaks - unwraps nil optional
}