Note that there are some explanatory texts on larger screens.

plurals
  1. PORe-using the UIImagePickerController.cameraOverlayView
    text
    copied!<p>I have a hierarchy of views:<br> compView with two children:<br> bgView<br> objectView.</p> <p>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.</p> <p>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.</p> <p>Any ideas of what I might be doing wrong?</p> <p>Thanks, Eddy</p> <p>Here a bit of code to show you what I'm doing:</p> <p>From myViewController.m:</p> <pre><code>- (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]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload