samedi 9 juillet 2016

Check if UIImage property got assigned or not?


I have an UIImage property, and after shooting image from iPhone camera I assigned image object to this property, otherwise not. How can I check if this property contains image after shooting or not? Below my 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

Aucun commentaire:

Enregistrer un commentaire