I'm trying to crate a blurry header in my UITableView with a text label that has the vibrancyEffect, but with this code all I get is a blurry header without any text labels... What's wrong? :)
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section
{
// Header Background color
view.tintColor = [UIColor clearColor];
// header Text Color
UITableViewHeaderFooterView *header = (UITableViewHeaderFooterView *)view;
[header.textLabel setTextColor:[UIColor clearColor]];
//Header blur
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
UIVisualEffectView *visualEffectView;
visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
visualEffectView.frame = header.bounds;
[header addSubview:visualEffectView];
// Text vibrancyEffect
UIVibrancyEffect *vibrancyEffect = [UIVibrancyEffect effectForBlurEffect:blurEffect];
UIVisualEffectView *vibrancyEffectView = [[UIVisualEffectView alloc] initWithEffect:vibrancyEffect];
vibrancyEffectView.frame=header.textLabel.frame;
[vibrancyEffectView.contentView addSubview:header.textLabel];
[visualEffectView.contentView addSubview:vibrancyEffectView];
}
Thanks in advance!
This is late...but you set the text to a clear color. What did you expect this to do? :)
Anyway my suggestion would be to try something like this: