views:

772

answers:

1

Hi,

I have a hierarchy of views:
compView with two children:
bgView
objectView.

I'm passing objectView to the cameraOverlayView property of the UIImagePickerController. Once the ImagePicker is done I update the image in the bgView and I would like to continue to display the view tree including the objectView which was passed to the UIImagePickerController as an overlayView.

The problem is that after calling dismissModalViewControllerAnimated to close the UIImagePickerController, the objectView is not appearing, as if the UIImagePickerContoller is hiding it. I checked in the debugger and it doesn't seem to be dealocated. The pointer is still valid. But the view is not showing.

Any ideas of what I might be doing wrong?

Thanks, Eddy

Here a bit of code to show you what I'm doing:

From myViewController.m:

- (void)loadView {
 CGRect rect = self.navigationController.view.bounds;
 compView = [[UIView alloc] initWithFrame:rect];
 bgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Storage/dummy_bg.png"]];

 objectView = [[PropImageView alloc] initWithImage:[UIImage imageNamed:@"Storage/rasta.png"]];

 [objectView setUserInteractionEnabled:YES];
 [objectView setMultipleTouchEnabled:YES];
 [compView addSubview:bgView];
 [compView addSubview:objectView];
 self.view = compView;
 [self placeObject];
 [objectView release];
 [bgView release];
 [compView release];

}

- (void) placeObject
{
 NSLog(@"camera button pressed");

 // make sure camera is avaialble before setting it as source
 //

 if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
#if !TARGET_IPHONE_SIMULATOR
  UIImagePickerController* picker = [[UIImagePickerController alloc] init];

  picker.sourceType = UIImagePickerControllerSourceTypeCamera; 

  picker.delegate = self;
  picker.allowsEditing = NO;
  picker.view.hidden = NO;
  picker.cameraOverlayView = objectView;
  [self presentModalViewController:picker animated:NO];
  [picker release];

#endif
 }


// from PickImageAppDelegate.m
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
 // Dismiss the image selection, hide the picker and
 [picker dismissModalViewControllerAnimated:YES];  
 bgView.image = [self rotateImage:image byOrientationFlag:UIImageOrientationRight];
}
A: 

Hi Eddy-

Did you ever solve this problem? I'm facing the same issue. Thanks

Disco