views:

175

answers:

1

I have a number of views that use UITableView. (I use UIViewController and implement UITableViewDelegate and UITableViewDataSource interfaces.) I'm having trouble creating a tableview that leaves room at the top for a toolbar. How to I size and layout the Tableview so that it is less than full screen? Is this an AutoResizing mask problem?

Thanks, Gerry

+1  A: 

You need to modify the table view frame to size for the toolbar. For example, you would run something like the following:

CGRect tableFrame;
tableFrame.origin.x = 0;
tableFrame.origin.y = toolbarReference.frame.size.height;
tableFrame.size.width = self.view.frame.size.width;
tableFrame.size.height = self.view.frame.size.height - toolbarReference.frame.size.height;
tableviewReference.frame = tableFrame;

This calculates the coordinates and size minus the toolbar at the top and then sets the frame of the tableview to those coordinates.

rickharrison