IPad: Tables in Popover Views do not scroll to show selected row

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

(1) I have two popups that contain tables. Tables must scroll to a specific line to display the selection in the main view. Instead, the tables scroll down, but the actual selected row remains off-screen.

(2) All my action sheets are 320 wide.

In Interface Builder, all my views are created in landscape orientation. Only there is no main window, but I don't see a way to change this.

My configuration: . On startup, I get the following coordinates for my main window and main viewcontroller:

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

      

All other views then show these coordinates when called (on load, but before presenting them):

    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 shouldAutorotateToInterfaceOrientation

with

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

      

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

Problem 1: I have two pop-ups containing tables long enough to launch the screen. The tables should scroll to the selected row. They do scrolling, meaning they don't start visually on line 1, but they don't scroll enough to display the selected line.

alt text http://idisk.mac.com/mahboud//Public/keysig.png

alt text http://idisk.mac.com/mahboud//Public/instrumentlist.png

It looks like the inner UITable UITable is created with the wrong number and stays that way, but I checked both coordinates of the UITableView's scroll content and they seemed to be reasonable.

Problem 2: I think this is related to problem 1 because my action tables are 320 wide. I can only assume the iPad allows ActionSheets only 320 or 480 wide, somehow thinks the screen is oriented in portrait mode, it uses a narrower width.

There you have it. I can't believe I'm still worried about orientation issues. I swear Apple doesn't make it easy to create a landscape app. Any ideas?

+2


a source to share


1 answer


I kind of figured it out. If I take

[self.tableView scrollToNearestSelectedRowAtScrollPosition:UITableViewScrollPositionNone animated:YES];

      

from -viewDidAppear or -viewWillAppear and instead put it right after my -predflowPopovers ... then it works:



[popController presentPopoverFromBarButtonItem:keySigBBItem permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

[keySignatureTableVC.tableView scrollToNearestSelectedRowAtScrollPosition:UITableViewScrollPositionMiddle animated:NO];

      

What should happen is that both -viewDidAppear and -viewWillAppear must receive calls before presentPopover ... changes or reorients the view. What I am doing in these two methods is not working on the correct frame or borders. Scrolling seems to work.

0


a source







All Articles