Objective c 未在视图中加载图像
我已经创建了两个名为FirstView和SecondView的视图。SecondView的nib文件有一个UIImage视图对象作为其IBOutlet。现在,我从FirstViewController的方法中获得一个UIImage对象。现在,我正在使用该图像设置SecondViewController的imageView属性,然后在导航控制器中推送SecondView控制器的对象。第二个视图已加载,但该图像未显示在该视图中 代码如下:Objective c 未在视图中加载图像,objective-c,uiviewcontroller,uiimageview,Objective C,Uiviewcontroller,Uiimageview,我已经创建了两个名为FirstView和SecondView的视图。SecondView的nib文件有一个UIImage视图对象作为其IBOutlet。现在,我从FirstViewController的方法中获得一个UIImage对象。现在,我正在使用该图像设置SecondViewController的imageView属性,然后在导航控制器中推送SecondView控制器的对象。第二个视图已加载,但该图像未显示在该视图中 代码如下: - (void)imagePickerController:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo
{
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
SecondViewController *secondView=[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:[NSBundle mainBundle]];
secondView.imageView.image=img;
[self.navigationController pushViewController:secondView animated:YES];
}
在SecondViewController nib文件中,是否检查UIImageView是否连接到控制器的imageView出口
您是否检查过调试器中的各种值是否为零?一切都连接良好,亲爱的,但是secondViewController.imageView在NSLog中显示为空。如果imageView为空,则表示未在interface builder中正确设置出口。