我从父类
调用此方法imagepicker.m
- (void) imagePickerController:(UIImagePickerController *)thePicker didFinishPickingMediaWithInfo:(NSDictionary *)imageInfo
{
UIImage *imag = [imageInfo objectForKey:@"UIImagePickerControllerOriginalImage"];
NSData *imageData = UIImageJPEGRepresentation(imag,0.1);
[parentviewcontroller requestToParentWithImage:imageData];
}
这里parentviewcontroller在imagepicker.h中声明
@property(strong,nonatomic)UIViewController<SmartretailDelegate> *parentviewcontroller;
TASKLISTDATA.M
IMAG=[IMAGEPICKER alloc]init];
IMAG.parentviewcontroller=self;
我的问题是未分配parentviewcontroller。它是否已解除分配/崩溃?
答案 0 :(得分:1)
'strong'属性表示保留parentviewcontroller对象,并在取消分配imagePicker对象时将其释放。有关更多信息,请参阅此链接“Objective-C ARC: strong vs retain and weak vs assign”。
答案 1 :(得分:0)
听起来你需要更多地了解ARC (or Automated Reference Counting) works的方法。
当你的&#34; IMAG
&#34;对象由ARC发布,对parentviewcontroller的 强 引用也会被释放。