Problem with UIImagePickerController

Discussion in 'iPhone/iPad Programming' started by arnieterm, Apr 9, 2009.

  1. macrumors regular

    Joined:
    Aug 28, 2008
    #1
    I have created a very simple project that has two viewcontrollers
    WelcomeViewController and AddInfoViewController
    In the applicationDidFinsihLaunch method

    Code:
    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:
    Code:
    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
    Code:
    - (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??
    Thanks
    Arnieterm
     

Share This Page