Griffin Morandini
Griffin Morandini

Reputation: 53

CellForRowAtIndexPath not working

I have a settings page and I am unsure as to how to make the Log out work. I have been told to use CellForRowAtIndexPath to make it so when I click "Log out" I can set it to actually logout using PFUser.logout()

Im sure this is a simple answer but I could not find anything remotely close to what I was looking for, does anybody have a quick solution? Thank you so much in advance.

enter image description here

Upvotes: 1

Views: 105

Answers (1)

Victor Sigler
Victor Sigler

Reputation: 23459

You need to use the didSelectRowAtIndexPath method in the UITableViewDelegate protocol that tells the delegate that the specified row is now selected to handle the cell selected in the UITableView like in this way:

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

}

I hope this help you.

Upvotes: 5

Related Questions