【问题标题】:How to make the section header of a UITableView completely transparent如何使 UITableView 的部分标题完全透明
【发布时间】:2015-06-12 18:08:25
【问题描述】:

我有一个UIViewController 和一个UIImage 作为整个背景图像。我将UITableView 放入我的视图控制器并将其限制在底部、前导、尾随和一半高度。

目标是让table view的Section Header完全透明,这样背景图片通过section header可见。

这样做只会使它变灰而不清晰/透明:

self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.opaque = NO;

如何让它透明?

【问题讨论】:

  • 您的问题标题听起来像是您在询问该部分,而实际上您是在询问部分标题。

标签: ios objective-c iphone uitableview uitableviewsectionheader


【解决方案1】:

如果您使用self.tableView.tableHeaderView = YourHeaderView 声明了您的 tableHeader 视图;

更新它

UIView *tempTableView = self.tableView.tableHeaderView;

然后修改为:tempTableView.backgroundColor = [UIColor clearColor];

直接点赞:self.tableView.tableHeaderView.backgroundColor = [UIColor clearColor];

但如果您使用的是 UITableView 委托:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

您需要通过以下方式更新它:

UIView *tempTableView = [self.tableView viewForHeaderInSection:YourSection];

然后修改:tempTableView.backgroundColor = [UIColor clearColor];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多