【发布时间】:2016-02-23 08:38:03
【问题描述】:
我是初学者,请耐心解释,谢谢。
所以,基本上我在 parse 中有一个 bool 列,如果它是假的,我想显示一个图像,如果它是真的不显示任何东西。
这是我的代码:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let myCell = tableView.dequeueReusableCellWithIdentifier("todayCell", forIndexPath: indexPath) as! reqTodaysCell
let cellDataParse: PFObject = self.dataparse.objectAtIndex(indexPath.row) as! PFObject
var newReadQuery = PFQuery(className: "request")
newReadQuery.findObjectsInBackgroundWithBlock({ (objects, error) -> Void in
if let objects = objects {
for object in objects {
if object["reqRead"] as! Bool == true {
myCell.isRead.image = nil //here is where I say pic to be nil but what happens is that if the first one is true then it will remove the pic for all of them.
// and if its not true it should display the pic
} else {
myCell.isRead.image = UIImage(named: "newReq")
print("user not read")
}
}
}
})
如果我解释不正确,请告诉我,我会尽力再次解释。
【问题讨论】:
标签: swift parse-platform tableviewcell