Reputation: 6823
I am setting up a UITableView header view and would like this to be semi transparent. So that when the table scrolls up for example the top header is still shown but you can partially see the content through the view.
I have one view and one label (adding to the view) for the header view.
headerLabel.textColor = [UIColor colorWithWhite:0.4 alpha:1.0];
headerLabel.font = [UIFont systemFontOfSize:14.0];
[headerSectionView addSubview:headerLabel];
[headerLabel setBackgroundColor:[UIColor clearColor]];
[headerSectionView setBackgroundColor:[UIColor colorWithWhite:0.847 alpha:5.000]];
However, this does not show as transparent. I have tried to remove the label from the subviews of the view but this does still not work so it is not the label causing this. Is there anything else I need to set on the headerSectionView to have this work?
Upvotes: 1
Views: 2146
Reputation: 35131
Your alpha value is incorrect, it should be 0.5f
, not 5.0f
:
[headerSectionView setBackgroundColor:[UIColor colorWithWhite:0.847 alpha:.5f]];
Upvotes: 2