【发布时间】:2010-05-21 14:38:14
【问题描述】:
我有一个标签栏应用程序,其中一个标签使用导航控制器在一系列视图中移动。在最终视图上,有一个添加照片的按钮,它呈现了一个 UIImagePickerController。到目前为止,一切都很好 - 但是当我完成选择图像或取消操作时,会加载上一个视图,但没有标签栏。我确定我缺少一些基本的东西,但是任何关于如何正确释放 UIImagePickerController 的建议都将不胜感激。代码如下:
ImagePickerViewController *aController = [[ImagePickerViewController alloc]; initWithNibName:@"ImagePickerViewController" bundle:[NSBundle mainBundle]];
[self presentModalViewController:aController animated:YES];
[aController release];
//viewDidLoad
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
if([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]){
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
} else {
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
[window addSubview:imagePickerController.view];
//ImagePickerViewController imagePickerControllerDidCancel - FinalViewController is the last view in the stack controlled by a navigation controller which contains the button to present the UIImagePickerController
[picker dismissModalViewControllerAnimated:YES];
FinalViewController *aController = [[FinalViewController alloc initWithNibName:@"FinalViewController" bundle:[NSBundle mainBundle]];
[picker presentModalViewController:aController animated:YES];
[aController release];
【问题讨论】:
标签: iphone objective-c cocoa