I am implementing PFQueryTableViewController from Parse with sections and pagination. Because I am using sections, I need to set the 'load more' cell on my own. However, It seems that I can't access the method cellForNextPageAtIndexPath - I get an error: ''UITablView' does not have a member name 'cellForNextPageAtIndexPath' ' .
I've looked around and the only resource on the subject seems to be this unanswered question: cellForNextPageAtIndexPath in swift
Here's my code:
override func tableView(tableView: UITableView, cellForNextPageAtIndexPath indexPath: NSIndexPath) -> PFTableViewCell? {
return PFTableViewCell()
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath, object: PFObject!) -> PFTableViewCell? {
let objectId = objectIdForSection((indexPath.section))
let rowIndecesInSection = sections[objectId]!
let cellType = rowIndecesInSection[(indexPath.row)].cellType
var cell : PFTableViewCell
if (indexPath.section == self.objects?.count) {
cell = tableView.cellForNextPageAtIndexPath(indexPath) //'UITablView' does not have a member name 'cellForNextPageAtIndexPath'
}
switch cellType {
case "ImageCell" :
cell = setupImageCell(objectId, indexPath: indexPath, identifier: cellType)
case "PostTextCell" :
//cell = setupImageCell(objectId, indexPath: indexPath, identifier: "ImageCell")
cell = setupTextCell(objectId, indexPath: indexPath, identifier: cellType)
case "CommentsCell" :
cell = setupCommentsCell(objectId, indexPath: indexPath, identifier: cellType)
case "UpvoteCell" :
cell = setupUpvoteCell(objectId, indexPath: indexPath, identifier: cellType)
case "DividerCell" :
cell = setupDividerCell(indexPath, identifier: cellType)
default : print("unrecognised cell type")
cell = PFTableViewCell()
}
cell.selectionStyle = UITableViewCellSelectionStyle.None
return cell
}
I know it's kind of late, but I just figured this out and wanted to share for future visitors.
If you want to customize the usual "Load more..." pagination cell in parse, do the following:
1) Create a new class that subclasses PFTableViewCell. For our demo purposes, we will call it PaginationCell.
2) Replace all of the contents of the PaginationCell class with the following:
Above we just initialized the cell with a reuseIdentifier of "paginateCell." This programmatically sets the reuseIdentifier.
3) In your PFQueryTableViewController, implement the following method:
3) Create a nib file. For our demo purposes I'll call the file paginateCellNib.xib. Design the custom cell however you want. Be sure to set the cell reuseIdentifier and make it match the one above. Set the custom class to the PaginationCell class we created above, and connect all IBoutlets to this class.
4) Now, replace the contents of the cellForNextPageAtIndexPath above with the following content: