pass image from one view controller to another in swift -



pass image from one view controller to another in swift -

i seek utilize segue pass image 1 view controller another, image null , cannot used.

here mainviewcontroller.swift, logs show right value.

func imagepickercontroller(picker:uiimagepickercontroller!,didfinishpickingmediawithinfo info: nsdictionary!){ var i:uiimage = info.objectforkey(uiimagepickercontrolleroriginalimage) uiimage nslog("%f, %f", i.size.width, i.size.height); orignal = nslog("iamge %@", orignal) performseguewithidentifier("showphoto", sender: self) dismissmodalviewcontrolleranimated(false) } override func prepareforsegue(segue: uistoryboardsegue!, sender: anyobject!) { var imageeditcontroller:imageeditviewcontroller = segue.destinationviewcontroller imageeditviewcontroller imageeditcontroller.editimage = orignal nslog("iamge %@", imageeditcontroller.editimage) }

here view controller "imageeditviewcontroller.swift"

import uikit class imageeditviewcontroller: uiviewcontroller { @iboutlet var imageditview : uiimageview var editimage:uiimage=uiimage() @ibaction func dodecoratebtn(sender : anyobject) { print("here text chage5") } @ibaction func doemailbtn(sender : anyobject) { print("here text chage6") } init(coder adecoder: nscoder!) { super.init(coder: adecoder) nslog("iamge2 %@", editimage) } override func viewwillappear(animated: bool) { super.viewwillappear(animated) nslog("iamge1 %@", editimage) } override func viewdidload() { super.viewdidload() // additional setup after loading vie } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } }

so see logs in view controller, var editimage not initialized right value. new ios , help.

i figure out, problem not think, image can pass viewcontroller. problem due deprecate api. "dismissmodalviewcontrolleranimated". more detail pls see question. dismissmodalviewcontrolleranimated deprecated

swift

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -