iosswiftparse-platformpfquerytableviewcontrollepftableviewcell

PFQueryTableView Custom cell Separator not showing


In my PFQueryTableViewController, the custom PFTableViewCell's dont have any separators and i don't know why.

enter image description here

I didn't find anything when googeling.

What am I doing wrong?

    class CategoryTableViewController: PFQueryTableViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
            }

    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        self.loadObjects()
    }


    // Initialise the PFQueryTable tableview
    override init(style: UITableViewStyle, className: String?) {
        super.init(style: style, className: className)
    }

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

        // Configure the PFQueryTableView
        self.parseClassName = "Category"

        self.pullToRefreshEnabled = true
        self.paginationEnabled = false


    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    // Mark - PFQueryTableViewController

    override func queryForTable() -> PFQuery {

        var query = PFQuery(className: self.parseClassName!)

        return query
    }

    // Mark: UITableViewDataSource

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath, object: PFObject!) -> (PFTableViewCell!) {
        var cell = self.tableView.dequeueReusableCellWithIdentifier("cell") as! PFTableViewCell


        cell.accessoryType = UITableViewCellAccessoryType.Checkmark
        cell.textLabel?.text = object["name"] as? String

        return cell
    }
}

Solution

  • I had the same problem. Didn't find out what causes it yet, but here's a hack that I did which might help you too. In cellForRowAtIndexPath add this:

    var separator = CALayer()
    separator.backgroundColor = UIColor.lightGrayColor().colorWithAlphaComponent(0.2).CGColor
    separator.frame = CGRectMake(0, 100, self.view.frame.size.width, 1);
    cell.layer.addSublayer(separator)
    

    This will add a 1px layer that looks like a separator. You can play with the color, width of it.