I finally was able to pull an array of images from parse after fiddling with tutorials. from that array I want to throw it on an imageview via next random image with a swipe gesture
var query = PFQuery(className:"cats")
//query.whereKey("username", equalTo:followedUser)
query.findObjectsInBackgroundWithBlock {(objects: [AnyObject]?, error: NSError?) -> Void in
if error == nil {
// The find succeeded.
//println("Successfully retrieved \(objects!.count) scores.")
// Do something with the found objects
for object in objects! {
// Update - replaced as with as!
//self.titles.append(object["Title"] as! String)
// Update - replaced as with as!
self.imageFiles.append(object as! PFObject)
println(self.imageFiles)
self.view.addGestureRecognizer(rightSwipe)
//self.tableView.reloadData()
}
} else {
// Log details of the failure
println(error)
}
}
the print line(self.imageFiles) actually shows the array of files which is great, what I'm having issues with is using the random generator. Still new to syntax, I was trying to do like imageview.image = imageFiles[0] or something like that to just display one of the images in the array. not really sure the syntax though. and I'm guessing once i get that it would be imageview.image = imageFiles[RandomNumber] or the equivalent.
for the swipe part I think I got that under control
thanks guys.
PS Most of my posts end up being super confusing so please ask and I will clear it up.
Aucun commentaire:
Enregistrer un commentaire