[英]Custom Table cell does not conform to NilLiteralConvertible Swift Xcode 6 Beta 5
So before i was registering Nib table cells like this through out all beta's but they must have changed a few things and i'm unsure as to how to make this work now, i've tried removing it from the if statement but when using tags for textfields, the textfields reset the first time when typing in them.. 因此,在我通过所有beta版本注册这样的Nib表单元之前,但是它们一定已经做了一些更改,并且我不确定现在如何使它工作,我曾尝试从if语句中删除它,但是在使用标记时对于文本字段,在键入文本字段时会第一次重置它们。
It displays as NSObject does not conform to NilLiteralConvertible. 它显示为NSObject不符合NilLiteralConvertible。
var mailCell: mailTableCell = tableView!.dequeueReusableCellWithIdentifier("mailCell", forIndexPath: indexPath) as mailTableCell
if mailCell == nil {
var nib: NSArray = NSBundle.mainBundle().loadNibNamed("mailTableCell", owner: nil, options: nil)
mailCell = nib.objectAtIndex(0) as mailTableCell
}
You don't need the if statement and associated code. 您不需要if语句和关联的代码。 dequeueReusableCellWithIdentifier:forIndexPath:
always returns a valid cell. dequeueReusableCellWithIdentifier:forIndexPath:
始终返回有效的单元格。
From the documentation - 从文档中 -
Return Value 返回值
A UITableViewCell object with the associated reuse identifier. 具有关联的重用标识符的UITableViewCell对象。 This method always returns a valid cell. 此方法始终返回有效的单元格。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.