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 8541445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:50:01+00:00 2026-06-11T11:50:01+00:00

I have an app that is loading a overlay controller (shows camera so I

  • 0

I have an app that is loading a overlay controller (shows camera so I can scan). It works great on the iPhone and it works great on the iPad after I call it a second time. Let me explain.

I have a UIButtonBarItem that loads a view controller modally. There are several controls on in the controller, most buttons (defined using a nib). If I load the controller (by responding to the UIButtonBarItem action) on an iPhone, it loads and all the buttons work fine, every time.

But… if I load the same view controller using an UIPopoverController, none of the buttons will respond the first time I load it. So, I touch the screen somewhere outside of the controller and dismiss the controller. Then, I touch the same action button again and now when the controller loads, all the controls in the the view controller work great. REALLY WEIRD!

[POSSIBLE HINT]
The buttons were placed all over the place in weird positions when I loaded it the first time. Each subsequent call had the buttons showing in the right places. I got this to work by disabling “Autoresize subviews” in the nib. The buttons are now in the right places but they still won’t respond when I load this popover the first time.

Here’s the code I’m using to respond to the UIButtonBarItem.

 -(void)launchOverlayController:(id)sender
 {
if([pickerControllerPopover isPopoverVisible])
{
    [pickerControllerPopover dismissPopoverAnimated:YES];
    pickerControllerPopover = nil;
    return;
}

// Deselect any selected cell
[self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:NO];


// Working code that shows the overlay (camera on) but the overlay takes the whole screen
SRSScanVINViewController *scanVINViewController = [[SRSScanVINViewController alloc] init];
[pickerController setOverlay:scanVINViewController];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:scanVINViewController];
[navController setModalPresentationStyle:UIModalPresentationFormSheet];
[navController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[[UIApplication sharedApplication] setStatusBarHidden:YES];
if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
{
    pickerControllerPopover = [[UIPopoverController alloc] initWithContentViewController:pickerController];
    [pickerControllerPopover setDelegate:self];
    [pickerControllerPopover setPopoverContentSize:CGSizeMake(320.0f, 460.0f)];
    [pickerControllerPopover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
else
{
    [self presentViewController:pickerController animated:YES completion:nil];
}

 }

I’m totally out of ideas. I can’t see why the controls within the overlaycontroller would work fine every time I call it except for the first time.

Thanks for anyones help in advance.

  • 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-06-11T11:50:02+00:00Added an answer on June 11, 2026 at 11:50 am

    So the answer is that the superclass is mucking with your view. I’m going to guess it was not designed to be subclassed, but no way to know for sure. What it does in one of the ‘view..’ methods is to override self.view with its own view, and make your view a subview of that view. The first time around it makes the frame of your view have zero dimensions. The next time it leaves it as it was before – maybe some persistent flag. It also inserts the view at different places in its subviews, which seems odd but if you have the code you’d probably see why.

    Soooo – the solution to the problem is to just move your view’s subviews to the superView (the subclass’s view), then set your view’s frame to the null frame:

    - (void) viewWillAppear:(BOOL)animated
    {
        [super viewWillAppear:animated];  // StackOverflow says to add this TCL?
    
        // Set the initial scan orientation
        [self setLayoutOrientation:self.parentPicker.orientation];
    
        if ([self.parentPicker hasFlash])
        {
            [flashButton setEnabled:YES];
            [flashButton setStyle:UIBarButtonItemStyleBordered];
            [self.parentPicker turnFlash:NO];
        } else
        {
            [flashButton setEnabled:NO];
        }
    
        textCue.text = @"";
        viewHasAppeared = NO;
    
        // move the subviews    
        while([self.view.subviews count]) [self.view.superview addSubview:[self.view.subviews objectAtIndex:0]];
        self.view.frame = CGRectMake(0,0,0,0);
    }
    

    PS: note that you were missing a superView call here but it didn’t seem to matter much (you don’t know which method your complex superclass may want so I’d be sure to send them everything you intercept.

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

Sidebar

Related Questions

I have an ipad app that is loading data remotely into core data, I
I have a webview in my app that generally works fine for loading websites.
I have an app that lets the user interact with several forms. I can
I have an App that downloads and displays images from URL's. This works fine
I have an app that works with tabs and webview. I already have it
We have a Flex app that is currently loading an XML file that contains
I Have a Silverlight WPF app that shows tabs of data in this case
I have an iPhone app that starts in a table view and goes to
I have an iPad app that is not showing a table created programmatically. Where
I have an app that loads the camera and overlays buttons for fire, reload,

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.