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];
}
親愛的一切都很好連接,但當我在NSLog中看到secondViewController.imageView顯示「null」。 – anurag 2010-05-27 15:31:17
如果imageView爲空,那麼這意味着在界面構建器中未正確設置插座。 – 2010-05-27 16:08:55