Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6204169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:02:34+00:00 2026-05-24T05:02:34+00:00

I have two overlay images that I want show in camera view depending on

  • 0

I have two overlay images that I want show in camera view depending on the device orientation – one for the horizontal and one for vertical orientation (overlay_v.png and overlay_h.png). When device is rotated from portrait to vertical orientation, overlay image should change as well.

With beginGeneratingDeviceOrientationNotifications I am able only to determine the device orientation but cannot manage to change the overlay images. Any help / different approach would be very appreciated.

- (IBAction) getPhoto:(id) sender {
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;

    if((UIButton *) sender == choosePhotoBtn) {
        sourceCamera = false;
        picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    } else {
        sourceCamera = true;
        picker.sourceType = UIImagePickerControllerSourceTypeCamera;

        //overlay image (cannot dynamically switch from vertical to horizontal in here)
        UIImageView *anImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"overlay_v.png"]];            
        anImageView.frame = CGRectMake(0, 0, anImageView.image.size.width, anImageView.image.size.height);
        picker.cameraOverlayView = anImageView;

        //device orientation check   
        [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didOrientation:) name:@"UIDeviceOrientationDidChangeNotification" object:nil];

        [anImageView release];        
    }
    [self presentModalViewController:picker animated:YES];

}
 

- (void) didOrientation: (id)object {
    UIInterfaceOrientation interfaceOrientation = [[object object] orientation];

    if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
        NSLog(@"portrait");
    } else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft ){
        NSLog(@"landscape");
    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:02:34+00:00Added an answer on May 24, 2026 at 5:02 am

    You can’t change the cameraOverlayView property once the picker is displayed. However, you can modify the view itself. Create a UIView property named overlayView. Add both images as subViews to this view and use the tag property on each image to easily grab that view again. Hide the one that shouldn’t be shown for the current orientation.

    - (void) didOrientation: (id)object {
       UIInterfaceOrientation interfaceOrientation = [[object object] orientation];
       UIImageView *pImageView = [self.overlayView viewWithTag:10];
       UIImageView *lImageView = [self.overlayView viewWithTag:20];
    
       if (interfaceOrientation == UIInterfaceOrientationPortrait || 
           interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
          NSLog(@"portrait");
          pImageView.hidden = NO;
          lImageView.hidden = YES;
       } else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight || 
          interfaceOrientation == UIInterfaceOrientationLandscapeLeft ){
          NSLog(@"landscape");
          pImageView.hidden = YES;
          lImageView.hidden = NO;
       }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ho I have two list view on a frame layout. I want one overlay
In a nutshell I have two images I want to overlay one over the
I have two UILabels. that I want to overlap one atop the other. Call
I have two bitmap images. One contains a picture taken with a usb camera.
I have two images that need to be overlaid over one another, and they
I have two classes (MVC view model) which inherits from one abstract base class.
I have got two images, say png and jpeg and I need to overlay
How can I overlay two images? Essentially I have a background with no alpha
I have two bitmaps that differ only by color. The green one is used
I have two images. One could be any size and aspect ratio. The other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.