gpt4 book ai didi

ios - PFImageView 未显示在窗口中

转载 作者:行者123 更新时间:2023-11-30 14:16:49 25 4
gpt4 key购买 nike

我正在尝试使用 snapchat 克隆进行解析,一切都很顺利,但是当我必须为用户显示图像时,PFImageView 没有显示,我不知道,因为没有错误出现,只是没有 subview 。

有问题的部分:

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")
}
}

最佳答案

检查您的 Supporting Files/ParseStarterProject-Bridging-Header.h 文件并查看是否缺少以下行:

#import <ParseUI/ParseUI.h>

如果是这样,请务必添加它。

关于ios - PFImageView 未显示在窗口中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31050955/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com