I\'ve got a grouped UITableView in a UITableViewController and I want to resize it horizontally.
I tried many different ways but none of them was perfect.
To fix the headers being resized I would try:
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
CGFloat headerHeight = 40;
UIView *headerView = [[UIView alloc] initWithFrame: CGRectMake(0, 0, self.view.frame.size.width, headerHeight)];
UILabel *cellLabel = [[UILabel alloc] initWithFrame: headerView.frame];
[cellLabel setText: @"My Text"];
[cellLabel setBackgroundColor: [UIColor clearColor]];
[headerView addSubview: cellLabel];
return headerView;
}
- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 40;
}
This code should replace this method:
- (NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section