我想在表的最后一行下面创建一个按钮(不是动态的)。所有的行和部分都是固定的。我是否必须创建另一个部分和行来添加一个按钮?如果是,我怎样才能将按钮调整到与单元格相同的宽度和曲率?
这是我做的。我为按钮创建了一个特定部分并为其创建了一行。
}else if(indexPath.section ==2)
{
UIButton *cellButton = [UIButton buttonWithType:UIButtonTypeCustom];
[cellButton setFrame:CGRectMake(0.0f, 5.0f, cell.frame.size.width, 44.0f)]; // not filling the round parts of the cell
[cellButton setBackgroundColor: [UIColor yellowColor]];
[cellButton setTitle:@"test" forState:UIControlStateNormal];
[cell.contentView addSubview:cellButton];
}
return cell;
最佳答案
你不知道。将您的按钮设置为表格 View 的表格页脚 View 。
tableView.tableFooterView = myButton;
关于ios - 在单元格中创建和调整 UIButton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11733699/