This works on iOS8.1 simulator perfectly. Original code:
func updateCell(path:Int){
let indexPath = NSIndexPath(forRow: path, inSection: 0)
tableView.beginUpdates()
tableView.reloadRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade)
tableView.endUpdates()
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell:PhotoCell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as PhotoCell
if data[indexPath.row].objectId == ""{
getData.getData(universityData.tableName, sender: self, cellId: indexPath.row)
}else{
var subviews = cell.subviews
for view in subviews{
view.removeFromSuperview()
}
}
tableView.separatorStyle = UITableViewCellSeparatorStyle.None
let screenSize: CGRect = UIScreen.mainScreen().bounds
let screenWidth = screenSize.width;
tableView.rowHeight = screenWidth + 38
//Other cell stuff here
return cell
}
But on iOS7.1 simulator, 1. All the cells start as stacked together on top of the top cell, than slide down in a second 2. When the cells first load they look normal 3. On the 2nd load which calls the "else" part in the code the cells start disappearing instead of reloading
I found an answer like this and tried to change the code this way:
else{
for view in cell.contentView.subviews{
if view.isKindOfClass(UIView){
view.removeFromSuperview()
}
}
}
Case 1&2 are still happening. But the cells toggle between the 2 images, first a normal clean cell, second a cell with old data still inside:
Ok so the question is, how to have the cells load consistently both on iOS 7.1 & 8.1?
Edit2:
Feed View Controller:
http://pastebin.com/aqyxpimi
Custom Cell:
http://pastebin.com/4eMgkBc1