View Full Version : Problem with UIImagePickerController

Apr 9, 2009, 06:24 AM
I have created a very simple project that has two viewcontrollers
WelcomeViewController and AddInfoViewController
In the applicationDidFinsihLaunch method

WelcomeScreenViewController* welcome = [ [WelcomeScreenViewController alloc] initWithNibName:@"WelcomeScreen" bundle:nil];
[window addSubview: welcome.view];

There is a button on Welcome screen on whose click, I show another view controller
as shown:

AddInfoViewController* addinfo = [ [AddInfoViewController alloc] initWithNibName: @"AddInfo" bundle:nil ];
CGRect f = self.view.frame;
f.origin.y = 0;
addinfo.view.frame = f;
//[navController pushViewController:addchild animated:YES];
[self.view insertSubview:addinfo.view aboveSubview:self.view];

Then the addinfo has a button to show the UIImagePickerController for selecting an image from photo album

I am also able to get the event when the user select "Choose" for an image

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
selectPhoto.view.hidden = YES;
[selectPhoto dismissModalViewControllerAnimated:YES];

My problem is that when the UIImagePickerController goes away from screen it also takes away the addinfo viewcontroller and I am only seeing the welcomeviewcontroller
What is wrong with my approach?
Any idea??