0

I'm using Parse.com to build my app.

I initialized a PFQueryTableViewController as my subclass.

I'm unable to tap the indexPath.row so that the cell leads to another viewController and passes data.

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {

       print("tapped")
        //Nothing prints. The simulator cell doesn't even change color as it normally does... 

}

In a normal project without Parse, I tap and it leads me to where I want it to lead. I don't understand why that doesn't work here.

I referenced several links, such as:

  1. https://www.parse.com/questions/pfquerytableview-didselect-row-open-pbobject-in-uiwebview (outdated and objective-c)
  2. https://www.parse.com/questions/using-pfquerytableviewcontroller-in-detail-view (didn't work)
  3. didSelectRowAtIndexPath method at PFQueryTableViewController (also didn't work)

None have helped.

Im also trying to use a UIGestureecognizer on the view from the custom cell. This isn't helping either...

This is the attributes inspector:

http://postimg.org/image/3omx3serh/

I've selected and deselected the relevant parts. Nothing works.

EDIT: I'm also using an initializer:

 override init(style: UITableViewStyle, className: String!)
    {
        super.init(style: style, className: className)

        self.pullToRefreshEnabled = true
        self.paginationEnabled = false
        self.objectsPerPage = 25

        self.parseClassName = className
        self.tableView.rowHeight = 120
        self.tableView.allowsSelection = false
    }

required init?(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
}

Any idea why I can't tap cell? Any ideas on how to tap the cell?

Community
  • 1
  • 1
Lukesivi
  • 2,206
  • 4
  • 25
  • 43
  • Do you have a uibutton or something else that could be receiving the tap and not passing down to your cell? – Tyrelidrel Nov 10 '15 at 16:17
  • It should be the cell itself. didSelectRowAtIndexPath should be triggering a segue to another viewController. Or even being recognized that a cell exists. The cellForRowAtIndexPath works and it prints on the UI different labels and buttons. But i want the cell itself to capture a touch. – Lukesivi Nov 10 '15 at 17:14

2 Answers2

1

Firstly I would check if your Table View has "User Interaction Enabled" enabled inside Attribute Inspector.

Secondly I would examine which class has been inserted inside your View Controller's Identity Inspector.

TekMi
  • 191
  • 6
  • I'm creating the cell in a XIB file. The cell is the correct class and it's the class that I'm referencing in the `PFQueryTableViewController`. Check my updated answer – Lukesivi Nov 10 '15 at 17:14
1

I'm also using an initializer that I'm accessing. This PFTableViewController I'm building only in code. For those building in code and not in the storyboard, make sure self.tableView.allowsSelection = true. Saw other links experiencing similar problems. Here the full code of the initializer:

override init(style: UITableViewStyle, className: String!)
{
    super.init(style: style, className: className)

    self.pullToRefreshEnabled = true
    self.paginationEnabled = false
    self.objectsPerPage = 25

    self.parseClassName = className
    self.tableView.rowHeight = 120
    self.tableView.allowsSelection = true
}

required init?(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
}

Realized that self.tableView.allowsSelection = false was set to false instead of true.

I set it to true and now it works.

Lukesivi
  • 2,206
  • 4
  • 25
  • 43