Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

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

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.

Yes, adjust the contentInset and scrollIndicatorInsets are the convenient way to resize the UITableView. As the answer of Sam Soffes posted, I succeed resize UITableView in UITableViewController for the bottom UIToolbar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top