views:

34

answers:

1

I have created 2 views named "FirstView" and "SecondView". SecondView's nib file has an UIImage view object as its IBOutlet. Now I am getting an UIImage object from some FirstViewController's method. Now I am setting the SecondViewController's imageView property with that image and then I am pushing my SecondView Controller's object in Navigation Controller. The SecondView gets loaded but that image is not shown in that view.

The code is as follows:

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

}
A: 

In SecondViewController nib file, have you check that the UIImageView is connected to the imageView outlet of the controller ?

Have you check in the debugger if the various values are not nil ?

Laurent Etiemble
Everything is well connected dear but secondViewController.imageView is showing "null" when i have seen in NSLog.
anurag
If imageView is null, then this means that the outlet was not properly set in interface builder.
Laurent Etiemble