title: Multiple Custom UITableViewCell Overwriting Eachother Swift
body: <p>I am attempting to create a table view with multiple Custom UITableViewCells. If I only use one custom cell the correct cell is displayed. If I add my second cell, The display second cell overwrites the first and inhibits interaction, and the second cell displays default data of the first custom cell until it is selected then it displays the correct cell.</p>
  
  <pre><code>class ViewController: UIViewController {
  
  @IBOutlet weak var tableView: UITableView!
  override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view, typically from a nib.
      let nib1 = UINib(nibName: "AccountCell1", bundle: nil)
      tableView.registerNib(nib1, forCellReuseIdentifier: "SettingCell1")
      let nib2 = UINib(nibName: "AccountCell2", bundle: nil)
      tableView.registerNib(nib2, forCellReuseIdentifier: "SettingCell2")
      //removing empty rows
      tableView.tableFooterView = UIView()
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
   func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
  
      return 1
  }
  
   func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
  
      return 2
  }
  
  
   func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
      /*let cell = tableView.dequeueReusableCellWithIdentifier( "AccountCell", forIndexPath: indexPath) as! UITableViewCell*/
      let cell1 = tableView.dequeueReusableCellWithIdentifier( "SettingCell1", forIndexPath: indexPath) as! AccountCell1Controller
      let cell2 = tableView.dequeueReusableCellWithIdentifier( "SettingCell2", forIndexPath: indexPath) as! AccountCell2Controller
  
      // Configure the cell...
      if(indexPath.row == 0)
      {
          let imageName = "Amanda.jpeg"
          let image = UIImage(named: imageName)
          cell1.UserImage.image = image
          cell1.UserLabel.text = "@AmandaSmith"
          cell1.setNeedsLayout()
          return cell1
      }
      else
      {
          return cell2
      }
  
  
  }
   func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -&gt; String? {
      if(section == 0)
      {
          return "John Smith"
      }
      else if(section == 1)
      {
          return "Settings"
      }
      else if(section == 2)
      {
          return "About"
      }
      return ""
  }
   func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -&gt; CGFloat {
      if(indexPath.row == 0)
      {
          return 204
      }
      else if(indexPath.row == 1)
      {
  
          return 61
      }
      else {
  
          return 44
      }
  }
  
  
  }
  </code></pre>
  
  <p>My Account cell controllers, 2 is two buttons with corresponding actions</p>
  
  <pre><code> class AccountCell1Controller: UITableViewCell {
  @IBOutlet weak var UserImage: UIImageView!
  @IBOutlet weak var UserLabel: UILabel!
  
  override func awakeFromNib() {
      super.awakeFromNib()
      let user = UserData.self
      // Initialization code
  }
  
  override func setSelected(selected: Bool, animated: Bool) {
      super.setSelected(selected, animated: animated)
  
      // Configure the view for the selected state
  
  }
  
  }
  </code></pre>