gpt4 book ai didi

xcode - 从 Parse 中提取图像到一个数组中

转载 作者:行者123 更新时间:2023-11-28 09:09:32 27 4
gpt4 key购买 nike

我在 Parse 上有一个表,其中有一个包含制造商名称的“名称”字段和一个包含 .png 图像作为 Parse 中的 PFFiles 的“ Logo ”表。出于某种原因,当我将图像添加到数组中时没有任何反应,但“名称”字段很好地填充到一个单独的数组中。我在这里做错了什么?

//Pulling down Manufacturer names & images from Parse
var manuQuery = PFQuery(className:"Manufacturers")
manuQuery.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]?, error: NSError?) -> Void in
if error == nil {
// The find succeeded.
println("Successfully retrieved \(objects!.count) Manufacturers.")
// Do something with the found objects
if let objects = objects as? [PFObject] {
for thing in objects {

self.manuList.append(thing["name"] as! String)
//self.tableView.reloadData()

let userPicture = thing["logo"] as! PFFile
userPicture.getDataInBackgroundWithBlock({ (imageData, error) -> Void in

if (error == nil) {
let image = UIImage(data:imageData!)
self.logoList.append(image!)
self.tableView.reloadData()
}

})

}
}
println(self.manuList)
println(self.logoList.count)

} else {

// Log details of the failure
println("Error: \(error) \(error!.userInfo!)")

}
}

提前谢谢你。

最佳答案

想通了。我需要将 PFFiles 加载到 ViewDidLoad() 中的数组中,然后获取 cellForRowAtIndexPath 中的数据以呈现它。不能 100% 确定它是如何工作的,但它确实起到了作用。

关于xcode - 从 Parse 中提取图像到一个数组中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29708818/

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