我创建了两个名为“FirstView”和“SecondView”的视图。 SecondView的nib文件有一个UIImage视图对象作为其IBOutlet。现在我从一些FirstViewController的方法获取一个UIImage对象。现在我用该图像设置SecondViewController的imageView属性,然后我在Navigation Controller中推送我的SecondView Controller的对象。第二个视图已加载,但该视图中未显示该图像。
代码如下:
- (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];
}
答案 0 :(得分:0)
在SecondViewController
nib文件中,您是否检查过UIImageView是否已连接到控制器的imageView
插座?
如果各种值不是nil,您是否已检入调试器?