ios - Objective C - How to change image from another class (another UIViewController) -
ios - Objective C - How to change image from another class (another UIViewController) -
i'm using nsobject class handle few server methods.
one of methods download images db (parse.com).
the problem uiviewcontroller nowadays image loaded faster download process (the image nil), , 2 sec after image in device.
how can update uiimageview image (userprofile class) nsobject class (the 1 download method)?
uiviewcontroller image in uitabbar i know how observe end of downloading process don't know how reach uiimageview property other class.
use delegate requirement. check implement delegate or ios_delegates how can done.
some understanding given below :
say u have delegate method in nsobject class handle few server methods
@protocol younsobjectclassdelegate <nsobject> @required -(void)imagedownloaded:(uiimage*)image; @end add
@property (nonatomic,strong) id<younsobjectclassdelegate> delegate; while allocating object whatever viewcontroller , don't forgot intialize delegate
yournsobjectclassobject.delegate = self; when image downloaded in nsobject class
if ([delegate respondstoselector:@selector(imagedownloaded:)]) { [delegate imagedownloaded:image]; } in uiviewcontroller u want have image add together these method
-(void)imagedownloaded:(uiimage*)image { //set image here } ios objective-c iphone xcode parse.com
Comments
Post a Comment