Ios UITableView空单元格不使用填充单元格的背景色
如何使下面的空单元格与表中的第一项具有相同的背景色和不透明度?我还想保持圆角,但在获取空单元格的背景颜色时遇到问题,同时保持表格不透明以查看背景Ios UITableView空单元格不使用填充单元格的背景色,ios,xcode,uitableview,background-color,Ios,Xcode,Uitableview,Background Color,如何使下面的空单元格与表中的第一项具有相同的背景色和不透明度?我还想保持圆角,但在获取空单元格的背景颜色时遇到问题,同时保持表格不透明以查看背景 - (void)viewDidLoad { self.itemsTableView.layer.cornerRadius = 5; [super viewDidLoad]; } - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)ta
- (void)viewDidLoad {
self.itemsTableView.layer.cornerRadius = 5;
[super viewDidLoad];
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)tableCell forRowAtIndexPath:(NSIndexPath *)indexPath {
UIView* myBackgroundView = [[UIView alloc] initWithFrame:CGRectZero];
myBackgroundView.backgroundColor = [UIColor blackColor];
myBackgroundView.opaque = NO;
myBackgroundView.alpha = 0.7;
tableCell.backgroundView = myBackgroundView;
tableCell.opaque = NO;
tableCell.alpha = 0.7;
}
这些不是空单元格,它们只是默认显示的分隔符。听起来您真正想做的是调整表视图的大小以适应现有的单元格。请尝试将页脚视图设置为空视图。设置页脚视图将做什么?它将删除单元格下方额外的装饰分隔符。但我希望它们在那里?我希望手机背景与第一个一样,但不确定你是否理解我的问题。