更新到最新的 XCode 7 beta 5 后,我的应用程序表现得很奇怪。发布后我得到了这个:
页面多次更新后:
在几次更新之后,该部分再次正常(但其他部分存在错误):
调试器中的所有时间似乎都很好:所有数据都从服务器加载并发送到表......
有没有人有任何想法,为什么会这样?
代码:
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
}