title: indexPathForSelectedRow returns nil although I have a cell programmatically selected
body: <p>I have a <code>UITableView</code> which I load with some application settings. I need the table to be single-select, and since the table holds settings there might be a chance some cell will be programmatically selected based on the setting enabled status.</p>
  
  <p>Currently, I'm experiencing a weird behaviour where if I programmatically select a cell then <code>indexPathForSelectedRow</code> returns <code>nil</code> (when it should return the index for the cell I selected), thus when I tap on a second cell (to change the currenty selected setting) I end up with two cells selected (even when I set <code>allowMultipleSelection</code> to false in my tableView object).</p>
  
  <p>Here's my code:</p>
  
  <pre><code>override func viewDidLoad() {
      tableView.allowsMultipleSelection = false
  }
  
  override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
      let cell: UITableViewCell? = tableView.dequeueReusableCellWithIdentifier("myCell")
  
      if let cell = cell {
          // tableObject is an array containing settings model
          let row = tableObject[indexPath.row]
          cell.textLabel!.text = row.settingValue
          if row.selected {
              cell.setSelected(true, animated: false)
              cell.accessoryType = .Checkmark
          }
          cell.tag = row.id
      }
  
      return cell!
  }
  
  override func tableView(tableView: UITableView, willSelectRowAtIndexPath indexPath: NSIndexPath) -&gt; NSIndexPath? {
      // oldIndex is always nil for the cell I called setSelected in cellForRowAtIndexPath
      if let oldIndex = tableView.indexPathForSelectedRow {
          if let oldCell = tableView.cellForRowAtIndexPath(oldIndex) {
              tableView.deselectRowAtIndexPath(oldIndex, animated: true)
              oldCell.accessoryType = .None           
          }
      }
  
      if let cell = tableView.cellForRowAtIndexPath(indexPath) {
          cell.setSelected(true, animated: true)
          cell.accessoryType = .Checkmark
      }
  
      return indexPath
  }
  
  override func tableView(tableView: UITableView, willDeselectRowAtIndexPath indexPath: NSIndexPath) -&gt; NSIndexPath? {
      if let cell = tableView.cellForRowAtIndexPath(indexPath) {
          cell.accessoryType = .None
          tableView.deselectRowAtIndexPath(indexPath, animated: true)
      }
      return indexPath
  }
  </code></pre>
  
  <p>Any idea how I can always have only one cell selected at a time?</p>
  
  <p>Thanks!</p>