我需要检查并显示固定tableView中Parse类中的对象数,每个对象都有一个“guide”关键字,tableView的每一行都以这些关键字命名。
问题:无法将数据添加到数组
我的想法是搜索它们,将结果放入数组中:
var totalOfTotalArray : [Int] = []
然后,为了逐个显示数字,每一行都有:
switch indexPath.row {
cell.guideNumberOfMexLabel.text = String(self.totalOfTotalArray[indexPath.row])
}
这是查询
for pfKeyword in KeyWords.guideKeywordArray {
var findHowManyMexQuery = PFQuery(className: KeyWords.ParseClassForPublicMessages)
findHowManyMexQuery.whereKey("guide", containsString: pfKeyword) //MARK: - filter for Parse - should filter parse query
findHowManyMexQuery.whereKey("messagePosition", nearGeoPoint: PFGeoPoint(location: myPosition), withinKilometers: kRadiusMessages) //MARK: geolocalized filter
findHowManyMexQuery.countObjectsInBackgroundWithBlock {
(count: Int32, error: NSError?) -> Void in
if error == nil {
self.totalOfTotalArray.append(Int(count)) //Array never filled up
}
}
}