开发者

image is not getting loaded in view

I have created 2 views named "FirstView" and "SecondView".SecondView's nib file has an UIImage view object as its IBOtlet.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 Controlle开发者_如何学JAVAr.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];  
}


The view is probably not loaded from the nib yet. So the IBOutlets are not hooked up already. In firstView, set a property on secondView, and in the viewDidLoad method of this secondView, set the imageView.image to this property.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜