开发者

UINavigationController EXC_BAD

i am using a UINavigationController in my application. in the first view i am displaying some information and have a button for loading an picture from the camera. this works fine so far. when the picture was loaded, i want to display the picture in a UIImageView within a second view. Therefore i am using the following code.

MyAppDelegate *delegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
CorrectedImageController *imageController = [[CorrectedImageController alloc] initWithNibName:@"CorrectedImageView" bundle:nil];
self.correctedImageViewController = imageController;
[imageController release];      
[delegate.navController pushViewController:imageController animated:YES];

The second view is loaded and the picture is shown. But i get an EXC_BAD_ACCESS message in the Debugger Cons开发者_如何转开发ole and my Application blocks the UI.

In the second view the picture is loaded as follows:

- (void)viewDidLoad {
  MyAppDelegate *delegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
  [imageView setImage:delegate.correctedImage];
  [super viewDidLoad];
}

Can anybody tell me, what i did wrong ? My nib file looks:

-File's Owner (Corrected Image Controller)
-First Responder (UIResponder)
-View (UIView)
--ImageView (UIImageView)

The File's owner view property is connected to the view. And the imageView property is connected to the ImageView.

Can anybody tell me, what i did wrong ?

BR, Martin


I believe this is because you are calling release on the imageController (line 5) and then trying the pushModalView the object you just released (line 6). If your self.correctedImageViewController is retaining the imageController, you could push the self.correctedImageViewController or release the imageController after the push.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜