简体   繁体   English

自定义表格单元格不符合NilLiteralConvertible Swift Xcode 6 Beta 5

[英]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.

相关问题 自定义表格单元格TextField:没有重用表格单元格的索引路径Swift Xcode6 Beta 6 - Custom Table Cell TextField: no index path for table cell being reused Swift Xcode6 Beta 6 类型'string'不符合协议NilLiteralConvertible - Type 'string' does not conform to protocol NilLiteralConvertible Swift(beta 3)“NSDictionary? 不符合协议'Equatable'“ - Swift (beta 3) “NSDictionary? does not conform to protocol 'Equatable'” 自定义表格视图单元格,带有swift in xcode 6 - Custom table view cell with swift in xcode 6 CGPoint不符合Swift中的自定义协议 - CGPoint does not conform to custom protocol in Swift 类型'AppDelegate'不符合协议'CLLocationManagerDelegate' - Xcode 6中的Swift - Type 'AppDelegate' does not conform to protocol 'CLLocationManagerDelegate' - Swift in Xcode 6 在Xcode中看到为什么“类型不符合协议”(swift) - see why “type does not conform to protocol” in Xcode (swift) Xcode Swift Argument 类型不符合预期类型“解码器” - Xcode Swift Argument type does not conform to expected type 'Decoder' Swift自定义表格单元格 - Swift custom table cell Xcode Beta 4中出现范围错误,导致“类型'Float'不符合协议'ForwardIndex'”错误 - Getting “Type 'Float' does not conform to protocol 'ForwardIndex'” Error with Ranges in Xcode Beta 4
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM