I have a UITableView
with 5 different sections. For one of those sections I have added a UIButton
by doing:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
if (section == 5) {
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 64)];
UIButton *button1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button1 setTitle:@"Button" forState:UIControlStateNormal];
button1.frame = CGRectMake(8, 8, 96, 44);
[view addSubview:button1];
return view;
}
return nil;
}
The problem that I am having is this: Since the Header for a section is by default aligned to the left, button is being aligned to the left, I have looked all around for a solution but can't seem to find one, your help/advice is appreciated!