When using a custom cell in a UITableView I am getting a strange table overlap:
Problem
The problem with cell identifier must be unique
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cellId:String = "Cell"+String(indexPath.row)
var cell = tableView.dequeueReusableCellWithIdentifier(cellId)
if (cell == nil){
cell = UITableViewCell(style: .Default, reuseIdentifier:cellId)
}
let cellText:String = String(indexPath.row)
let subjectField:UILabel = UILabel(frame: CGRect(x:55, y: 25, width: 303, height: 25))
subjectField.text = cellText
(cell! as UITableViewCell).addSubview(subjectField)
return cell! as UITableViewCell
}