After instantiating the EditCountsTableViewCell
programmatically its outlets return nil when accessed, and I therefore cannot edit the cells. The cells behave normally when instantiated with the Storyboard.
@IBAction func countNameChanged(sender: AnyObject) {
let textField = sender as! UITextField
let text = textField.text
let superview = textField.superview!
let cell = superview.superview as! EditCountsTableViewCell
let indexPath = self.tableView.indexPathForCell(cell)
let row = indexPath?.row
var newCell = EditCountsTableViewCell() //Instantiate Cell Programatically
println(newCell)
println(newCell.countName) //nil
if let name = newCell.countName{
name.text = text
}
if let value = newCell.countValue{
value.text = cell.countValue.text
}
tableViewContents[row!] = newCell
}
EditCountsTableViewCell
Class:
import UIKit
class EditCountsTableViewCell: UITableViewCell {
@IBOutlet weak var countName: UITextField!
@IBOutlet weak var countValue: UITextField!
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
}
}