UITableView didSelectRowAtIndexPath sometimes called after second tap

前端 未结 2 766
傲寒
傲寒 2020-12-19 01:58

I\'m facing a curious UITableView behaviour and i don\'t know where this is coming from. I\'m building a very simple single view IOS8 Swift application with a f

相关标签:
2条回答
  • 2020-12-19 02:22

    Try this.

    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
      dispatch_async(dispatch_get_main_queue(), {
        self.performSegueWithIdentifier("homeToDetail", sender:self)
      })
    }
    

    This is a bug in iOS 8, I think. UITableViewCell selection Storyboard segue is slow - double tapping works though

    0 讨论(0)
  • 2020-12-19 02:33

    You have to call [tableView deselectRowAtIndexPath:indexPath animated:YES]; to fix this

    0 讨论(0)
提交回复
热议问题