My cell is either holding collegename or username but it is not holding both values even though i have textlabels on my cell in the storyboard 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 = "_User"
self.textKey = "username"
self.pullToRefreshEnabled = true
self.paginationEnabled = false
}
override func queryForTable() -> PFQuery {
var query = PFQuery(className: "_User")
query.orderByAscending("username")
return query
}
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath, object: PFObject?) -> PFTableViewCell? {
let cellIdentifier = "cell"
var cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier) as? PFTableViewCell
if cell == nil {
cell = PFTableViewCell(style: .Default, reuseIdentifier: cellIdentifier)
}
if let usernametable = object?["username"] as? String {
cell?.textLabel?.text = usernametable
}
if let collegename = object?["collegename"] as? String {
cell?.textLabel?.text = collegename
}
return cell
}
cell?.textLabel?.text = usernametableand then overriding the label textcell?.textLabel?.text = collegename. Can you show yourPFTableViewCellcode? - alephaoUILabelsvar instead ofcell?.textLabel- alephao