CellForRowAtIndexPath不起作用

时间:2016-01-27 15:35:16

标签: ios swift uitableview

我有一个设置页面,我不确定如何使注销工作。我被告知使用CellForRowAtIndexPath来实现它,当我点击“注销”时,我可以使用PFUser.logout()将其设置为实际注销

我确定这是一个简单的答案,但我找不到任何与我想要的东西相近的东西,有人有快速的解决方案吗?非常感谢你提前。

enter image description here

1 个答案:

答案 0 :(得分:5)

您需要在didSelectRowAtIndexPath协议中使用UITableViewDelegate方法,该方法告诉委托现在选择指定的行来处理UITableView中选择的单元格,如下所示:

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
   // call to the PFUser.logout() here to log out the user properly
   print(indexPath.row)

}

我希望这对你有所帮助。