ios - I'm trying to populate a tableview with a list of users, but the tableview will not load anything -
for reason keep getting blank tableview. showing query being loaded parse, isn't displaying results. in advance help.
class userviewcontroller: pfquerytableviewcontroller { override init(style: uitableviewstyle, classname: string!) { super.init(style: style, classname: classname) } required init(coder adecoder: nscoder) { super.init(coder: adecoder) self.pulltorefreshenabled = true } override func queryfortable() -> pfquery { var query: pfquery = pfuser.query()! println(query) return query } override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath, object: pfobject!) -> pftableviewcell { var usercell = tableview.dequeuereusablecellwithidentifier("cell2") as! pftableviewcell! if usercell == nil { usercell = pftableviewcell(style: uitableviewcellstyle.default, reuseidentifier: "cell2") } if let lastname = object["lastname"] as? string { var firstname = object["firstname"] as? string usercell?.textlabel?.text = "\(lastname), \(firstname)" } if let adminstatus = object["adminstatus"] as? bool { if adminstatus == true { usercell?.detailtextlabel?.text = "administrative privliges" }else{ usercell?.detailtextlabel?.text = "non administrative privliges" } } return usercell } override func viewwillappear(animated: bool) { self.navigationcontroller?.navigationbarhidden = false } }
it seems not initializing class properly, need set name of class want query
// initialise pfquerytable tableview override init!(style: uitableviewstyle, classname: string!) { super.init(style: style, classname: classname) } required init(coder adecoder: nscoder) { super.init(coder: adecoder) // configure pfquerytableview self.parseclassname = "yourclass" self.textkey = "yourobject" self.pulltorefreshenabled = true self.paginationenabled = false }
i hope code helps you
Comments
Post a Comment