Mat*_*ees 7 uitableview ios ios8
所以我在iOS 7.1中测试了它,它运行正常.我正在使用下面的行设置背景颜色以清除我的tableview.
self.tableview = [[UITableView alloc]initWithFrame:self.bounds style:UITableViewStylePlain];
self.tableview.delegate = self;
self.tableview.dataSource = self;
self.tableview.backgroundView = nil;
self.tableview.backgroundColor = [UIColor clearColor];
self.tableview.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];
[self addSubview:self.tableview];
Run Code Online (Sandbox Code Playgroud)
我还将tableFooterView设置为一个新视图,以隐藏任何剩余未使用的单元格.
self.tableview.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];
Run Code Online (Sandbox Code Playgroud)
这在iOS 7上运行得非常好,但在iOS 8中,我在桌面视图下留下了白色背景颜色.tableview坐在里面的superview也有一个清晰的背景颜色.有任何想法吗?
下面添加了图片 - 我不得不模糊客户名称
在iOS 7上工作
不适用于iOS 8.1
苹果文档称
...在 iOS 7 中,单元格默认背景为白色;在早期版本的 iOS 中,单元格继承封闭表视图的背景颜色。如果要更改单元格的背景颜色,请在表视图委托的 tableView:willDisplayCell:forRowAtIndexPath: 方法中执行此操作。
您可能需要使用 willDisplayCell UITableView 委托方法来为表视图提供透明背景。
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cellforRowAtIndexPath:(NSIndexPath *)indexPath
{
[cell setBackgroundColor:[UIColor clearColor]];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2356 次 |
| 最近记录: |