Resize UITableView to fit toolbar

by alex 12. May 2009 16:03

CGFloat toolbarHeight = 50;

CGRect mainViewBounds = self.view.bounds;

[toolbar setFrame:CGRectMake(CGRectGetMinX(mainViewBounds),

CGRectGetMinY(mainViewBounds) + CGRectGetHeight(mainViewBounds) - (toolbarHeight),

CGRectGetWidth(mainViewBounds),

toolbarHeight)];

 

 

UIView *footerView = [[[UIView alloc] initWithFrame:CGRectMake(CGRectGetMinX(mainViewBounds), 

CGRectGetMinY(mainViewBounds), 

CGRectGetWidth(mainViewBounds), 

toolbarHeight+5)] autorelease];

 

tableView = [[UITableView alloc

initWithFrame:CGRectMake(mainViewBounds.origin.x, mainViewBounds.origin.y, mainViewBounds.size.width, mainViewBounds.size.height - toolbarHeight -5

style:UITableViewStyleGrouped];

tableView.delegate = self;

tableView.dataSource = self;

tableView.tableFooterView = footerView;

tableView.backgroundColor = [UIColor clearColor];

[self.view addSubview:tableView];


Currently rated 4.5 by 2 people

  • Currently 4.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

General

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen