2010-05-27 94 views
1

我创建了2个名为“FirstView”和“SecondView”的视图。 SecondView的nib文件具有UIImage视图对象作为它的IBOutlet。现在我从一些FirstViewController的方法获取UIImage对象。现在我使用该图像设置SecondViewController的imageView属性,然后在导航控制器中推送我的SecondView控制器对象。 SecondView被加载,但该图像没有显示在该视图中。图像没有在视图中加载

的代码如下:

- (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

SecondViewController笔尖文件,你检查的UIImageView连接到imageView出口控制的?

如果各种值不是零,你检查调试器吗?

+0

亲爱的一切都很好连接,但当我在NSLog中看到secondViewController.imageView显示“null”。 – anurag 2010-05-27 15:31:17

+0

如果imageView为空,那么这意味着在界面构建器中未正确设置插座。 – 2010-05-27 16:08:55