0

After updating to latest XCode 7 beta 5, my application is behaving very strange. After launch I got this:

empty cell bug

After several updates of the page:

empty cell bug

And again after several updates the section went normal (but bugs in another sections):

enter image description here

All the time in debugger all seems to be good: all the data is loaded from server and sent to table...

Does anybody have any ideas, why this is happening?

Code:

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell:EventCell = self.contentWindow.dequeueReusableCellWithIdentifier("evcell")! as! EventCell

    let dateFormatter = NSDateFormatter()
    dateFormatter.dateFormat = "HH:mm"
    var index = 0;
    for date in keysSet {

        if (index==indexPath.section)
        {
            cell.timeLabel.text = dateFormatter.stringFromDate(datesOfEvents[date]![indexPath.row].time)
            cell.nameLabel.text = datesOfEvents[date]![indexPath.row].title
            print(index)
            print(cell.nameLabel.text)
            if datesOfEvents[date]![indexPath.row].state == MessageState.SENT {
                cell.nameLabel.textColor = UIColor.blackColor()
            }
            else {
                let currentDate = NSDate()
                if datesOfEvents[date]![indexPath.row].time > currentDate {
                    cell.nameLabel.textColor = UIColor.blueColor()
                }
                else
                {
                    cell.nameLabel.textColor = UIColor.redColor()
                }
            }
            break;
        }
        index++

    }
    //cell.backgroundColor = UIColor(colorLiteralRed: 39, green: 185, blue: 200, alpha: 0)
    //cell.textLabel?.textColor = UIColor(colorLiteralRed: 255, green: 255, blue: 255, alpha: 1)
    cell.textLabel?.numberOfLines = 0;

    return cell
}
  • Try using `dequeReusableCellWithIdentifier:forIndexPath` rather than the version you are using. For cell reuse you should use the forIndexPath version. It may or may not be part of your issue. On current releases, cells returned using the version you are using have no size class versus cells using the forIndexPath version do. Easy change to try first. – Rory McKinnel Aug 28 '15 at 17:48
  • This is very unusual code. Why is there a loop? – danh Aug 28 '15 at 17:50
  • Rather than a loop and if `keysSet` is a NSSet, just use `keysSet.allObjects as Array` and get the date at index `indexPath.section`? Very odd way you are doing things! – Rory McKinnel Aug 28 '15 at 18:02

1 Answers1

0

I also had this problem in iOS 9.1. If you're only developing for one device family per storyboard, try unchecking "Use Size Classes" in the file inspector of the storyboard. It solved it for me.

enter image description here

Arjan
  • 16,210
  • 5
  • 30
  • 40