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

  • SEARCH
  • Home
  • 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 1048221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:25:20+00:00 2026-05-16T16:25:20+00:00

problem in adding second UIbutton in cameraOverlayView ,here i am able to add the

  • 0

problem in adding second UIbutton in cameraOverlayView ,here i am able to add the first button but not able to add second button with following code

- (void)pickAndDecodeFromSource:(UIImagePickerControllerSourceType) sourceType {
  [self reset];

  // Create the Image Picker
  if ([UIImagePickerController isSourceTypeAvailable:sourceType]) {
    UIImagePickerController* aPicker =
        [[[UIImagePickerController alloc] init] autorelease];
    aPicker.sourceType = sourceType;
    aPicker.delegate = self;
    self.picker = aPicker;


    // [[NSUserDefaults standardUserDefaults] boolForKey:@"allowEditing"];
    BOOL isCamera = (sourceType == UIImagePickerControllerSourceTypeCamera);
    if ([picker respondsToSelector:@selector(setAllowsEditing:)]) {
      // not in 3.0
      [picker setAllowsEditing:!isCamera];
    }
    if (isCamera) {
      if ([picker respondsToSelector:@selector(setShowsCameraControls:)]) {
        [picker setShowsCameraControls:NO];
        UIButton *cancelButton =
          [UIButton buttonWithType:UIButtonTypeRoundedRect];
        NSString *cancelString =
          NSLocalizedString(@"DecoderViewController cancel button title", @"");
        CGFloat height = [UIFont systemFontSize];
        CGSize size = 

          [cancelString sizeWithFont:[UIFont systemFontOfSize:height]];
        [cancelButton setTitle:cancelString forState:UIControlStateNormal];
          //cancelButton.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"CancelButtonForButton.png"]];
          //cancelButton.backgroundColor = [UIColor clearColor];
          //cancelButton.backgroundColor = [UIColor greenColor];
            [cancelButton setImage:[UIImage imageNamed:@"cancelForButton.png"] forState:UIControlStateNormal];
          //[cancelButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 

        CGRect appFrame = [[UIScreen mainScreen] bounds];
        static const int kMargin = 10;
        static const int kInternalXMargin = 10;
        static const int kInternalYMargin = 10;
        CGRect frame = CGRectMake(kMargin,
          appFrame.size.height - (height + 2*kInternalYMargin + kMargin),
          2*kInternalXMargin + size.width,
          height + 2*kInternalYMargin);
        [cancelButton setFrame:frame];
        [cancelButton addTarget:self
                         action:@selector(cancel:)
               forControlEvents:UIControlEventTouchUpInside];
        picker.cameraOverlayView = cancelButton;
        // The camera takes quite a while to start up. Hence the 2 second delay.
        [self performSelector:@selector(takeScreenshot)
                   withObject:nil
                   afterDelay:2.0];
          //cancelButton.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg.png"]];
      }
    }

    // Picker is displayed asynchronously.
    [self presentModalViewController:picker animated:YES];
  } else {
    NSLog(@"Attempted to pick an image with illegal source type '%d'", sourceType);
  }
}
  • 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-16T16:25:21+00:00Added an answer on May 16, 2026 at 4:25 pm

    The issue is that you are replacing the camera overlay with the first button – so creating the second button and using “picker.cameraOverlayView = newButton;” replaces the camera-overlay again.

    The solution is to create a parent UIView, add both buttons to it, and then set the camera overlay to be the parent UIView.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 508k
  • Answers 508k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer What you are doing is not actually getting a new… May 16, 2026 at 4:25 pm
  • Editorial Team
    Editorial Team added an answer In .Net, type resolution is based on the assembly name,… May 16, 2026 at 4:25 pm
  • Editorial Team
    Editorial Team added an answer Assuming that column1 is the real name of the column… May 16, 2026 at 4:25 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am trying to learn mysql and having some problem with updating/adding data to
I am adding musicCD information to a set. I have two different functions for
This is an annoying problem I am having with Twisted.web. Basically, I have a
I know this may be a dumb question, but my background is more in
I have already posted a question about this, but the situation has changed sufficiently
I have a query like the following that returns the correct number of rows
I have a Google Map, and I am adding event listeners to different things.
I have a Ruby code with different classes in a few files. In one
I'm converting an old program over to haml and I've got a problem with
I've got some problems adding a excel document as attachment on a custom list.

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.