Following this pattern.
// foo.m
Bar* bar = [[Bar alloc] init];
[baz setDelegate:bar];
[bar release];
I'm able to call UIImagePicker Delegates in the Bar Class. Specifically, didFinishPickingImage. However, I'm not able to set my the IBOutlet UIImageView myImageView. like.
// bar.m
- (void)imagePickerControl开发者_StackOverflow社区ler:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo
self.myImageView.image = img;
When I debug UIImageView, it's nil I think because the UIImage param passed to didFinishPickingImage is also blank.
My question is, why? I am assuming I set my delegate correctly as per this example.
You can't assign a UIImageView to a UIImage. This might work better:
self.myImageView.image = img;
Are you actually allocating memory for 'myImageView'? It isn't shown. That's not automatic, myImageView = [[UIImageView alloc] init];
would be needed
精彩评论