iPad: Tables in Popover Views do not Scroll to Show Selected Row

Posted by mahboudz on Stack Overflow See other posts from Stack Overflow or by mahboudz
Published on 2010-04-14T21:40:55Z Indexed on 2010/04/17 5:53 UTC
Read the original article Hit count: 510

I am having two problems with viewcontrollerss in landscape orientation on the iPad.

(1) I have two popups which hold tables. The tables should scroll to a specific row to reflect a selection in the main view. Instead, the tables do scroll down some but the actual selected row remains off screen.

(2) All my action sheets come up with a width of 320.

In Interface Builder, all my views are created in landscape orientation. Only the main Window is not, but I don't see a way to change that.

My Configuration: Upon launch, I get the following coordinates for my main window and the main viewcontroller view:

Window frame {{0, 0}, {768, 1024}} mainView frame {{0, 0}, {748, 1024}}

All other views after that show these coordinates when summoned (when loaded but before being presented):

    frame of keysig {{0, 0}, {1024, 768}}
    frame of instrumentSelect {{20, 0}, {1024, 768}}
    frame of settings {{0, 0}, {467, 300}}

In all my viewControllers, i respond to shouldAutorotateToInterfaceOrientation with:

            return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || 
                        (interfaceOrientation == UIInterfaceOrientationLandscapeRight));

Everything (almost) functions as expected. The app launches into one of the two landscape modes. The views (and viewcontrollers) display everything where it belongs and taps work all across the screen as expected. However, I still have the two problems.

Problem 1: I have two popups containing tables long enough to run off screen. The tables should scroll to a selected row. They do scroll i.e. they don't start visually at row 1 but they don't scroll enough to actually show the selected row.

alt text

alt text

It almost seems like a UITable internal rect gets created with the wrong number and stays that way but I've checked both of the UITableView's scrollView content coordinates and they seemed reasonable.

Problem 2: I think this is related to problem 1 because my actionsheets come up with a width of 320. I can only assume that the iPad allows actionSheets in only 320 or 480 widths and since it somehow thinks that the screen is oriented in portrait mode, it uses the narrower width.

There you have it. I can't believe I am still getting hung up on orientation issues. I swear Apple doesn't make it easy to have a landscape app. Any ideas?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about ipad