ios - Passing UIImage between ViewControllers -


in first view controller have uiimage property synthesized in implementation file. in second view controller pushed, create uiimage object there , @ same time set uiimage property first view controller. in end, dismiss second view controller. however, appears image not saved after viewcontroller dismissed. understanding since uiimage pointer, data passing reference , since controller dismissed, uiimage. correct , there better way accomplish task? reference, using arc.

in first view controller (firstvc),

@property (strong, nonatomic) uiimage *image; 

in second view controller,

[firstvc setimage:self.ivaruiimageview.image]; 

where ivaruiimageview defined as:

@property (strong, nonatomic) iboutlet uiimageview *ivaruiimageview; 

now lets in third view controller, have in viewdidload method:

imgview = [[uiimageview alloc] initwithimage:firstvc.image]; 

where imgview defined as:

@property (strong, nonatomic) iboutlet uiimageview *imgview; 

you want make sure uiimage retained first view controller, making property strong. if displaying in uiimageview have set uiimageview's image new image in order see change reflected in ui.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -