【发布时间】:2015-09-12 20:48:34
【问题描述】:
我有一个 PFQueryTableViewController。
我还有一个随机生成的数字数组,从 1 到 Parse 类计数。
在 Parse 中,类中的每个对象都分配有一个数字(1、2、3 等)
我想在 Parse 中从这个类中获取对象到表格视图单元格,并且顺序取决于数组的顺序。
例如,我的数组是 [3, 2, 5, 1, 4]
我想查询键“数字”在哪里等于这些数字,按顺序..
到目前为止,我有这个:
// Define the query that will provide the data for the table view
override func queryForTable() -> PFQuery{
var query = PFQuery(className: "Stores")
for i in 1...10 {
query.whereKey("number", equalTo: numArray[i])
}
return query
}
和
//override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath, object: PFObject?) -> PFTableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("cell") as! ExploreCell!
if cell == nil {
cell = ExploreCell(style: UITableViewCellStyle.Default, reuseIdentifier: "cell")
}
但是,每当我运行时,它只会从 1 个对象中获取信息。我的表格视图只有 1 个抓取数据的单元格。
【问题讨论】:
标签: arrays for-loop parse-platform tableview pfquery