在我的应用程序中,我在地图上的引脚上有一个注释视图中的rightCalloutButtons,按下时会拉出第二个视图。在第二个视图中,用户可以拍摄一张然后放入imageView的图片。我将图像分配给所选的mkannotation的图像属性,但图像未显示。有人能告诉我我做错了什么吗? 这是一些代码:
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
_annotation.image = image;
[imageView setImage:_annotation.image];
[self dismissViewControllerAnimated:YES
completion:nil];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[imageView setImage:_annotation.image]
}
这里是_annotation ivar设置为我存储在数组中的mkannotation的位置:
- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex {
if(buttonIndex==1)
{
_annotation = [[Data singleton].annotations objectAtIndex:identifier];
[[Data singleton] removePin:_annotation];
NSLog(@"The singleton array count is: %u", [Data singleton].annotations.count);
_vc = [[P2OViewController alloc]init];
[[self navigationController]pushViewController:_vc
animated:YES];
}
}
我的问题是,一旦拍摄完照片,它就不会出现在imageView中。