【发布时间】:2015-03-22 22:07:13
【问题描述】:
我正在尝试使用 PFTableViewCell 连接到主电视控制器的 2 个标签来填充 tableview
当我添加 (numberOfSectionsInTableView + numberOfRowsInSection ) 应用程序崩溃
但是当我删除它时它可以工作,但它什么也没显示。
这是表格视图单元格
class courseCell: PFTableViewCell {
@IBOutlet var name: UILabel!
@IBOutlet var location: UILabel!
}
这是表格视图控制器
class courseTVC: PFQueryTableViewController {
override init!(style: UITableViewStyle, className: String!) {
super.init(style: style, className: className)
}
required init(coder aDecoder:NSCoder)
{
super.init(coder:aDecoder)
self.parseClassName = "courses"
self.textKey = "Location"
self.pullToRefreshEnabled = true
self.paginationEnabled = false
}
override func queryForTable() -> PFQuery! {
var query = PFQuery(className: "courses")
query.orderByDescending("Location")
return query
}
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 4
}
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!, object: PFObject!) -> PFTableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("cell" , forIndexPath : indexPath) as? courseCell
if cell == nil
{
cell = courseCell(style: UITableViewCellStyle.Default, reuseIdentifier: "cell")
}
cell!.name.text = object["Price"] as! String!
cell!.location.text = object["Location"] as! String!
return cell!
}
我不知道如何解决这个问题
【问题讨论】:
标签: ios uitableview swift parse-platform