0

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..

It displays as NSObject does not conform to 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

        }
bevbomb
  • 689
  • 2
  • 12
  • 26

1 Answers1

0

You don't need the if statement and associated code. dequeueReusableCellWithIdentifier:forIndexPath: always returns a valid cell.

From the documentation -

Return Value

A UITableViewCell object with the associated reuse identifier. This method always returns a valid cell.

Paulw11
  • 108,386
  • 14
  • 159
  • 186
  • Ok i've tried running it without the if statement, but i receive "no index path for table cell being reused" every time i click on a textfield inside a table cell – bevbomb Aug 19 '14 at 23:20
  • Have a look at the this answer (the one with 4 votes) here - http://stackoverflow.com/questions/12772197/what-is-the-meaning-of-the-no-index-path-for-table-cell-being-reused-message-I it may be related – Paulw11 Aug 19 '14 at 23:24
  • Either way, that is the message you should be researching because that is your real issue – Paulw11 Aug 19 '14 at 23:28
  • That didn't seem to help as the textfields aren't working initially, but once i've entered each one once, they are fine and that error stops showing, but initially, all textField Delegate methods don't work – bevbomb Aug 19 '14 at 23:29
  • Perhaps open a new question with that message and show your initialisation code for your custom cell class – Paulw11 Aug 19 '14 at 23:32