After upgrading to Xcode 7 and iOS 9 beta, I am getting this error in one of my UITableViews. Whenever I scroll, my second label overlaps the first label in most of the cells. What is weird is that two of the current cells don't have this issue. See pictures for details.
override func viewDidAppear(animated: Bool) {
namesArray.removeAll(keepCapacity: false)
locationsArray.removeAll(keepCapacity: false)
let query = PFQuery(className: "Schools")
// query.whereKey(key: String, containedIn: [AnyObject])
query.findObjectsInBackgroundWithBlock { (objects: [AnyObject]?, error: NSError?) -> Void in
if error == nil {
query.orderByAscending("schoolName")
if let objects = query.findObjects() as? [PFObject] {
for object in objects {
self.namesArray.append(object.valueForKey("schoolName") as! String)
self.locationsArray.append(object.valueForKey("schoolLocation") as! String)
self.schoolTable.reloadData()
}
}
} else {
print("Shit, it didn't work...")
}
}
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell:ChangeSchoolListTableViewCell = tableView.dequeueReusableCellWithIdentifier("Cell") as! ChangeSchoolListTableViewCell
if namesArray.count > 0 {
cell.nameLabel.text = namesArray[indexPath.row]
cell.locationLabel.text = locationsArray[indexPath.row]
}
return cell
}
class ChangeSchoolListTableViewCell: UITableViewCell {
@IBOutlet var nameLabel: UILabel!
@IBOutlet var locationLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
Thank you very much.