[英]How to make the area above UITableView transparent
My original necessary was to make the area above uitableview transparent and show the imageview under it, just like this: 我最初的必要是使uitableview上方的区域透明,并在其下方显示imageview,如下所示:
I know there are many ways to implement this effect and I just wonder why cells can be transparent and show the content under them but the area above uitableview can't. 我知道有很多方法可以实现这种效果,我只是想知道为什么单元格可以透明并显示其下的内容,而uitableview上方的区域却不能。 Is there any way?
有什么办法吗?
将UITableView
的背景色设置为clearColor
将ui tableview背景色设为透明色
If you want transparent area only once then create UIView
with background color clearColor
. 如果您只希望透明区域一次,则使用背景颜色
clearColor
创建UIView
。 And set UITableView
header view tableView.tableHeaderView = headerView;
并设置
UITableView
标头视图tableView.tableHeaderView = headerView;
If you want transparent area for every section then - 如果您希望每个部分都具有透明区域,则-
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
//return height of transparent area
}
then, 然后,
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
// return UIView with clearColor.
}
如果您使用的是分组的表格视图(我看不到您提供的图像):
[self.tblView setBackgroundView:nil];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.