ios - Transfer image from one VC to another not working -
i image, when clicked upon, go view controller can view image itself! having little trouble doing , not sure how go there!
this variable declared pfobject
var postsarray = [pfobject]()
this code in cellforrowatindexpath tableview function
postsarray[indexpath.row]["image"].getdatainbackgroundwithblock { (data, error) -> void in if let downloadedimage = uiimage(data: data!) { postcellobj.postimage.image = downloadedimage postcellobj.postimage.layer.maskstobounds = true postcellobj.postimage.layer.cornerradius = 5.0 } }
i have button overlayed on top of button when button clicked, need image go vc said above. code in prepareforsegue function
if username != pfuser.currentuser()?.username { let profilevc: userprofileviewcontroller = segue.destinationviewcontroller as! userprofileviewcontroller profilevc.usernamestring = username } else if segue.identifier == "tophotoview" { let dvc = segue.destinationviewcontroller as! photoviewcontroller dvc.newimage = postimage }
and in other view controller, or destination view controller, need image clicked on appear cant figure out! small bit of code in destination view controller.
@iboutlet weak var image: uiimageview! var newimage: uiimage! override func viewdidload() { super.viewdidload() // additional setup after loading view. image.image = newimage }
i having hard time figuring out how because of fact in parse array , it's throwing me off, can me out?
this kind of issues should easy debug if know how to.
simply add break points @ dvc.newimage = postimage
, image.image = newimage
, launch app, click on cell, , watch variables.
normally, code gave seems fine. can check if postimage
valid object, , in viewdidload
, can check if dvc.newimage
image need.
if images correctly initialized , assigned, go.
btw, suspect either image
(which uiimageview
, , should change name reflect what's class) nil or newimage
not valid
some useful lldb command po
:
po image.image
po newimage
Comments
Post a Comment