如何让单元格中的文本显示为纯文本,同时仍然淡化单元格背景,以便我可以看到后面的图像?
我的 ViewController 中有以下内容: `
- (void)viewDidLoad {
// Used to see the background image
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"background.png"]];
self.tableView.backgroundView.contentMode = UIViewContentModeScaleAspectFill;
}
-(void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *) cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.alpha=0.5;
cell.textLabel.alpha=1.0;
}
结果显示在图像中,通过文本和单元格背景可以看到背景图像。我只想透过单元格背景查看图像并让文本保持不变。
有没有办法将文本的 alpha 设置为 1.0,而背景为 0.5?