0
我試圖用解析與我的手克隆克隆和一切都很好,但是當我必須顯示用戶的圖像PFImageView不顯示,我不知道因爲沒有錯誤顯示沒有子視圖。PFImageView沒有出現在窗口
違規的部分:
func checkForMessages() {
if PFUser.currentUser()?.username != nil {
println("checking for msgs")
var query = PFQuery(className: "Image")
query.whereKey("recipientUsername", equalTo: PFUser.currentUser()!.username!)
var msgs = query.findObjects()
println("\(msgs?.count) \(PFUser.currentUser()!.username!) recipientUsername")
var done = false
if let msg = msgs as? [PFObject] {
for msgReceived in msg {
if done == false {
var imageView: PFImageView = PFImageView()
imageView.file = msgReceived["image"] as? PFFile
imageView.loadInBackground({
(photo, error) -> Void in
if error == nil {
var displayedImage = UIImageView(frame: CGRectMake(0, 0, self.view.frame.width, self.view.frame.height))
displayedImage.image = photo
println(photo!.description)
self.view.addSubview(imageView) //here it should place it in the view
}
})
done = true
}
}
}
println(msgs?.count)
} else {
println("waiting for user this should be not showing")
}
}