0

背景画像全体としてaUIViewControllerがあります。UIImageビューコントローラーに a を入れて、UITableViewそれを下、先頭、末尾、および高さの半分に制限します。

目標は、テーブル ビューのセクション ヘッダーを完全に透明にして、背景画像がセクション ヘッダーから見えるようにすることです。

これを行うと、グレーになり、クリア/透明ではなくなります。

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

どうすれば透明にできますか?

4

1 に答える 1

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];

于 2015-06-12T18:18:26.460 に答える