UITableView with custom frame size within a UINavigationController... how?
I have a main view that with a UIView subview, inside of which I am programmatically adding a UINavigationController and UITableView that is encapsulated in a +regular UIViewController+, to allow it to be pushed/popped onto the navigation controller. I'm essentially just trying to get a table+navcontroller combination that only takes up about half the screen height.
The problem isn't that it doesn't work, because I have no problem getting the table and navigation controller working together as expected. The problem is that no matter what I do or try, I cannot get the table view to be smaller (in height), than full-size, meaning that when contained in this ~200px navcontroller-in-subview, there are a large number of rows the user cannot select because attempting to scroll to them immediately "bounces" back. You can see that the rows are there when you "pull" the scroll down, but can never get it to stay.
As it appears, the table view is too large in height. I've gone as far as setting the table to a height of 10, to no avail. Autoresize masks have no effect.
Please note that I'm NOT using an instance of UI TableViewController, but rather the plain vanilla UIViewController, because creating an instance of the former automatically creates the underlying UITableView, which was always sized to large, as well. I had some advice that I should attempt creating the table and view controller independently, add the former to the latter and then push the view controller onto the navigation controller. Again, this does work, but the size is all out of whack.
Finally, in quick psuedo-code, this is essentially what I'm doing:
(this is found in MainViewController::viewDidLoad)
CGRect frame = subviewContainer.frame;
frame.size.height = 10;
frame.origin.x = 0;
frame.origin.y = 0;
UITableView* table = [[UITableView alloc] initWithFrame:frame];
table.autoresizesMask = UIViewAutoresizingNone;
UIViewController* tVC = [[UIViewController alloc] init];
tVC.view = table;
UINavigationController* navC = [[UINavigationController alloc] initWithRootViewController:tVC];
[subviewContainer addSubview:navC.view];
Thanks for any tips you might have: this is quite the frustrating problem!
MacPro, Mac OS X (10.5.5), MBP 1st-gen