i have write ios app supports both ios 7 , 8 , in app have 2 view controllers , b navigation controllers , segue between them. when segue activates, have fetch data view controller view controller b. code works on ios 8 not on ios 7.
override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { // new view controller using [segue destinationviewcontroller]. // pass selected object new view controller. if segue.identifier == userdatasegue { let navcontroller = segue.destinationviewcontroller as? uinavigationcontroller if let userdatatableviewcontroller = navcontroller?.topviewcontroller as? userdatatableviewcontroller { userdatatableviewcontroller.userdata = user } } }
do know why happen , how can fix it? "work around" problem saving stuff in nsuserdefaults , reading in vc b make code mess.
i appreciate :d
don't forget create public property userdata in second viewcontroller.
override func prepareforsegue(segue: uistoryboardsegue!, sender: anyobject!) { if (segue.identifier == "seguetest") { var svc = segue!.destinationviewcontroller secondviewcontroller; svc.userdata = user } }
Comments
Post a Comment