我有一个包含两个部分的 tableView 我想在部分标题中添加一个按钮(操作按钮) 可以在示例图像中做同样的事情吗?
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
if(section ==0)
{
return 0;
}
else{
UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 300.0, 20.0)];
UIButton *button = [UIButton buttonWithType:UIButtonTypeContactAdd];
[button setFrame:CGRectMake(275.0, 5.0, 30.0, 30.0)];
button.tag = section;
button.hidden = NO;
[button setBackgroundColor:[UIColor clearColor]];
[button addTarget:self action:@selector(insertParameter:) forControlEvents:UIControlEventTouchDown];
[myView addSubview:button];
return myView; }
}