Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 图像未显示在imageView中_Objective C_Uiimageview - Fatal编程技术网

Objective c 图像未显示在imageView中

Objective c 图像未显示在imageView中,objective-c,uiimageview,Objective C,Uiimageview,在我的应用程序中,我在地图上有一个图钉,在annotationView中有RightCallout按钮,当按下按钮时,会拉起第二个视图。在第二个视图中,用户可以拍摄一张照片,然后将其放入imageView。我将图像指定给选定的mkannotation的image属性,但图像未显示。有人能告诉我我做错了什么吗? 下面是一些代码: - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMedia

在我的应用程序中,我在地图上有一个图钉,在annotationView中有RightCallout按钮,当按下按钮时,会拉起第二个视图。在第二个视图中,用户可以拍摄一张照片,然后将其放入imageView。我将图像指定给选定的mkannotation的image属性,但图像未显示。有人能告诉我我做错了什么吗? 下面是一些代码:

- (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]
}
这里是将_注释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中

愚蠢的问题,但必须提出:您的
IBOutlet
imageView
是否已连接?在OSX中,更新视图后,我们需要调用的显示方法。看看iOS中是否也有类似的东西。