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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:36:46+00:00 2026-05-23T04:36:46+00:00

On the iPad I show a UIPopover when the user selects cells in a

  • 0

On the iPad I show a UIPopover when the user selects cells in a UITableView. The cell stays selected until the popover is dismissed.

When the user rotates the device from portrait to landscape orientation and the selected cell was on the lower part of the screen, it will disappear after the rotation and the popover ends up pointing at another (indifferent) cell.

How can I make sure that the selected cell in a UITableView stays on screen when rotating from portrait to landscape orientation?

Update: Combining Caleb’s and kviksilver’s codes, the following is a working solution:

-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
    CGRect activeCellRect = [self.tableView rectForRowAtIndexPath:self.indexPath];
    if ((activeCellRect.origin.y + activeCellRect.size.height) >
        (self.view.frame.origin.y + self.view.frame.size.height))
    {
        // If a row ends up off screen after a rotation, bring it back
        // on screen.
        [self.tableView scrollToRowAtIndexPath:self.indexPath
                              atScrollPosition:UITableViewScrollPositionBottom
                                      animated:YES];
    }
}

Update 2, on repositioning the UIPopover: After the scroll command it is necessary to send a reloadData message to the table view. Then the rectForRowAtIndexPath: method will correctly report the new position of the cell (otherwise it will not, as it is not updated properly after the scroll-command)!

  • 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-23T04:36:47+00:00Added an answer on May 23, 2026 at 4:36 am

    On orientation change try checking indexPathsForVisibleRows to see if your cell is visible and then using scrollToRowAtIndexPath if not.. something like:

    -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
        if (![[self.tableView indexPathsForVisibleRows] containsObject:[self.tableView indexPathForSelectedRow]]) {
            [self.tableView scrollToRowAtIndexPath:[self.tableView indexPathForSelectedRow] atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a iPad app which has a popover which appears to show you
in my splitviewcontroller iPad app I show a custom popover (which loads the rootviewController).
i want to show my view as a model view. In iPad there are
I've got an iPad app with a drawer table displayed in a popover. The
In html elements if we use type=number for input field, IPAD will show numeric
Is there any reference about writing an application on iPad/iPhone to show HTML5 content
How do I show a help popup window on the iPad? I want to
I want to show a modal UIViewController with a custom frame in iPad, centered
I'm putting together a quick slide show on the iPad thats always in landscape
I'm using UISplitViewController for app on iPad. The first task was to show master

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.