CellForNextPageAtIndexPath not showing in swift2

I am implementing PFQueryTableViewController from Parse with sections and pagination. Since I use partitions, I need to set the "load more" cell myself. However, it seems that I cannot access the cellForNextPageAtIndexPath method - I get an error: "UITablView" does not have the member name "cellForNextPageAtIndexPath".

I looked around, and the only resource on this seems to be this unanswered question: cellForNextPageAtIndexPath in fast

Here is 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
}
+1
source share
1 answer

- , .

pagination " ..." , :

1) , PFTableViewCell. PaginationCell.

2) PaginationCell :

  import UIKit
  import Parse
  import ParseUI


 class PaginateCell: PFTableViewCell {



 override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
    super.init(style: style, reuseIdentifier: "paginateCell")


}

required init(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)!
}

reuseIdentifier "paginateCell". .

3) PFQueryTableViewController :

   override func tableView(tableView: UITableView, cellForNextPageAtIndexPath indexPath: NSIndexPath) -> PFTableViewCell? {


}

3) nib. paginateCellNib.xib. , . . PaginationCell, , IBoutlets .

4) cellForNextPageAtIndexPath :

    override func tableView(tableView: UITableView, cellForNextPageAtIndexPath indexPath: NSIndexPath) -> PFTableViewCell? {

    // register the class of the custom cell  
    tableView.registerClass(PaginateCell.self, forCellReuseIdentifier: "paginateCell")
    //register the nib file the cell belongs to
    tableView.registerNib(UINib(nibName: "paginateCellNib", bundle: nil), forCellReuseIdentifier: "paginateCell")

    //dequeue cell
    let cell = tableView.dequeueReusableCellWithIdentifier("paginateCell") as! PaginateCell

    cell.yourLabelHere.text = "your text here"





    return cell
}
+3

All Articles