问题
I need to check for, and then show, the number of objects in a Parse class in a fixed tableView, each object has a "guide" keyword, and each row of the tableView is named after those keywords.
problem: Can't add data to the array
my idea is to search for them, put result in an array:
var totalOfTotalArray : [Int] = []
and then, in order to show numbers one by one, each row will have:
switch indexPath.row {
cell.guideNumberOfMexLabel.text = String(self.totalOfTotalArray[indexPath.row])
}
this is the query
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
}
}
}
来源:https://stackoverflow.com/questions/33319345/parse-how-to-count-put-data-in-an-array-then-show-the-content-of-the-array