Reputation: 2226
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:
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?
Upvotes: 0
Views: 1232
Reputation: 2226
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.
Upvotes: 1
Reputation: 191
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.
Upvotes: 1