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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:21:57+00:00 2026-06-03T17:21:57+00:00

-I have a UIView. -This UIView has a UIButton that when clicked makes a

  • 0

-I have a UIView.
-This UIView has a UIButton that when clicked makes a UIAlertView appear.
-Within this UIAlertView I have another UIButton that when clicked calls buttonClicked:
-Within this buttonClicked: method, I call presentPopoverFromRect with a custom view inside. (hourKeyboard is the custom view)

-(void)buttonClicked:(id)sender
{
    if(self.hourKeyboard==nil)
    {
        self.hourKeyboard = [[HourKeyboardViewController alloc] init];
        self.hourKeyboardPopover = [[UIPopoverController alloc] initWithContentViewController:self.hourKeyboard];
    }

    [self.hourKeyboardPopover presentPopoverFromRect:[sender bounds] inView:sender permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
}

In normal portrait mode, this works great. The popover spawns just to the right of the button, with the arrow correctly pointing left to the button.

There’s 2 problems that arrises:
1) While this popover is visible, when you rotate the screen the popover rotates slightly incorrectly (it doesn’t reposition it’s own x and y position)
2) If the popover is not being shown. If you rotate the screen, then call “buttonClicked”, the popover will appear, however, its being shown sideways above the button with the arrow pointing “down” towards the button (technically left in relation to the sideways popover view). If you dismiss it, rotate the screen, then call “buttonClicked”, the popover now appears upside down with the button pointing “right” to the button (again, technically left in relation to the sideways popover view)! Repeat to make it sideways again, then right-side up again.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

My thinking:

1) I believe I can just reposition the x and y, however, I’ve also read that you should dismiss the popover and present it over again on a rotation. I’ll see if I can get the first one working, however I’m more concerned about the second problem.

2) I have no idea how to fix this rotation issue. It seems that when you rotate to landscape without the popover being visible. And then you call presentPopoverFromRect, the popover is created with the iPad thinking it’s still in portrait view by mistake. That’s the behavior it’s giving, however, I’m not sure how to make the iPad not make this mistake.

-=-=-=-=-=-=-=-=-=

Thanks again for any help you can provide!

-=-=-

Slight Update:
1) It was easy to just dismiss the popover from the main view on rotation. And this seems to be the general way everyone deals with this issue.

2) Trying out various things such as changing the frame, using CGAffineTransformMakeRotation, and others…but no luck thus far

-=-=-

Another Update:

2) After a lot of testing, it seems to be a direct issue with UIAlertView. If I place the view within UIAlertView (currently doing), the AlertView doesn’t tell the popover that the screen is rotated…thus creating the issue

It looks like the only way to fix this is to drop the UIAlertView completely. Instead of showing the UIAlertView, I’ll disable the various background views manually (like Alert View was doing) and then show a custom UIView that looks darn similar to the AlertView. From there, I should be able to show the popover without any issues. I’ll let yea know how it turns out.

-=-=-=-=-=-=-=-

Final Solution:

I ended up just creating my own view, and having that view imitate a UIAlertView. Then when I spawned the popover, I placed it in the root view controller. Worked much MUCH better, but required more work since I had to manually create my own View instead of the premade UIAlertView. Either way, apparently UIAlertView fails at telling a UIPopoverover subview what rotation it is in.

  • 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-03T17:22:00+00:00Added an answer on June 3, 2026 at 5:22 pm

    dismiss the popover in willRotateToInterfaceOrientation and show it again in didRotateFromInterfaceOrientation.

    It works with no problems.

    EDIT:
    Sorry, I misunderstood your second problem.

    If some part of your view hierarchy is displayed with bad orientation, one of your controllers is probably missing shouldAutorotateToInterfaceOrientation method.

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

Sidebar

Related Questions

I have a UIView subclass ( CustomView for purposes of this question) that has
I have a class that inherits from UIView, and this class has some controls
I'm having a problem. I have a UIView, that looks like this : In
I have a UIView that has several UIImageViews as subviews. Each of these subviews
I have an element that needs to behave like UIButton but it has several
I have a UIView subclass. This subclass has multiple subviews. Is it possible to
I have a UIView that has 3 sub-views: a header, a center panel, and
here i have this code that i'm trying where openingHoursView.ohLocation has two values value1
I have a UITableViewController which has a UIView* called errorView that is used to
I have a UIView subclass that draws a simple rectangle with this code: -

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.