我正在制作一个基本的iOS应用程序,在该应用程序中,我有一个table-view-controller。我需要此控制器根据我的Parse.com数据库中的信息填充单元格。
这是我特别需要的信息:
候选人图像(这是一个图像文件)
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
// Retrieves the name from DB
let nameQuery = PFQuery(className: "Candidate")
// Network request
nameQuery.findObjectsInBackgroundWithBlock {
(result: [AnyObject]?, error: NSError?) -> Void in
if error == nil && result != nil {
// The find succeeded.
println(result?.count)
} else {
// Log details of the failure
println("Error: \(error!) \(error!.userInfo)")
}
}
}
我可以按预期取回对象,但是如何仅获取名称和图像呢?我是否对每个信息都做两个单独的查询?
有大量关于iOS Swift + Parse的出色教程。深入研究教程,您将轻松地学习如何完成工作。
为了回答后面的问题,只要将名称和图像与Candidate类相关联,就只需一个查询。
祝你好运,玩得开心!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句