views:

1711

answers:

4

Is it possible to resize the UITableView on the RootController of a nav based app? When RootViewController.xib is opened in IB, there isn't a view. Just the UITableView. Clicking the inspector and then the little yellow ruler, frame height is grayed out. I'm adding a toolbar programmatically to the RootViewController:

[toolbar setFrame:rectArea];

That works fine but the bottom cell in the tableview is partially hidden because the tableview doesn't know about the toolbar.

+5  A: 

Yes, but you need to have a ViewController (not a UITableViewController) as the root controller for the nav, and wrap the actual UITableView in the UIViewControllers view.

You can still have the UIViewController conform to the UITableViewDelgate and Datasource protocols, and use all the same methods you have now in your UITableViewController.

P.S. you'll get more responses if you use the plain "iphone" tag.

Kendall Helmstetter Gelner
I thought it would probably have to go that way. Thanks on the tag tip.
4thSpace
+1  A: 

You could also just set the Content and Scroller inset of the tableview

Doesn't seem to work for me.
Dimitris
A: 

The easiest way, is to adjust the contentInset (which is inherited from UIScrollView). Resizing by setting the frame can cause crazy drawing bugs in cells.

For example, if you are trying to resize a tableview for the keyboard, do something like this:

tableView.contentInset = UIEdgeInsetsMake(0.0, 0.0, 216.0, 0.0);
tableView.scrollIndicatorInsets = tableView.contentInset;

Hope that helps someone. This way worked best for me.

Sam Soffes
A: 

I encountered a similar issue when attempting to display the detail controller by itself, see: http://vimeo.com/13054813

The issue is that the SplitView controller applies its own transform to the sub-controllers, taking them out of the orientation detection loop, which blows goats and seems incredibly 'hackish' for built-in classes. (The video illustrates what happens when you make the detail view the root view, then add it back to the split view and make the split view root while in landscape; you get double rotation of the detail view.)

Unfortunately I've again run into these transformation issues while attempting to resize a SplitViewController's detail sub-view in response to the keyboard appearing/disappearing. In portrait, all works fine, in landscape it's fscked.

GothAlice