从中选择图像后,我需要调用视图控制器imagePickerController
,因此我使用了以下代码:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
imageEditorView = [[ImageEditorViewController alloc]initWithNibName:@"ImageEditorViewController" bundle:nil];
imageEditorView.mainViewController = self;
imageEditorView.imageBG = [info objectForKey:UIImagePickerControllerOriginalImage];
[self presentViewController:imageEditorView animated:YES completion:nil];
}
但调试器给了我这个警告:
Warning: Attempt to present <ImageEditorViewController: 0xaa42320> on
<ViewController: 0x9b58680> whose view is not in the window hierarchy!
没有礼物!
如果我 dissMiss 它首先调试器会给我这个错误:
Warning: Attempt to present <ImageEditorViewController: 0xa913980> on
<ViewController: 0x9b332a0> while a presentation is in progress
!
已编辑
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil] autorelease];
} else {
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil] autorelease];
}
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}