出于某种原因,当我使用Parse将图像添加到tableView时,它正在从Parse中提取文件,但是没有按降序加载...不确定为什么?
感谢您的帮助!
class HomePageViewController:UIViewController,UITableViewDelegate {
@IBOutlet var homePageTableView: UITableView!
var albumImageFiles = [PFFile]()
var imageText = [String]()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
var query = PFQuery(className: "Posts")
query.orderByDescending("createdAT")
query.findObjectsInBackgroundWithBlock { (posts:[AnyObject]?, error: NSError?) -> Void in
if error == nil {
//success fetching objects
for post in posts! {
self.albumImageFiles.append(post["imageFile"] as! PFFile)
self.imageText.append(post["albumText"] as! String)
}
/*reload the table*/
self.homePageTableView.reloadData()
} else {
println(error)
}
}
}
答案 0 :(得分:3)
query.orderByDescending("createdAT")
应该是
query.orderByDescending("createdAt")