我有一个UIImage
属性,从 iPhone 相机拍摄图像后,我将图像对象分配给该属性,否则没有。拍摄后如何检查此属性是否包含图像?下面我的代码没有帮助。
@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