iphone - Check if UIImage property got assigned or not? -
i have uiimage
property, , after shooting image iphone camera assigned image object property, otherwise not. how can check if property contains image after shooting or not? below code didn't help.
@interface myviewcontroller : uiview<uinavigationcontrollerdelegate, uiimagepickercontrollerdelegate> @property(nonatomic, retain) uiimage *imageshot; @end @implementation myviewcontroller @synthesize imageshot = _imageshot; - (id)init { self = [super init]; if (self) { _imageshot = [[uiimage alloc] init]; } } - (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info { self.imageshot = [info objectforkey:uiimagepickercontrollereditedimage]; } - (void)buttonclick { if (_imageshot) { } else { } } @end
in init
, should create shotedimage
nil
instead of alloc'ing new, empty image. that'll allow perform tests if (!shotedimage)
(as nil == 0
).
Comments
Post a Comment