以下の画像のように、UITableViewの背景を透過にしてセルを半透明にする方法。

UITableViewControllerの- (void)viewDidLoad;に以下を書く
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView setBackgroundView:[[[UIView alloc] init] autorelease]];
}
UITableViewCellの- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier;に以下を書く
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self setSelectionStyle:UITableViewCellSelectionStyleNone];
[self setBackgroundColor:[UIColor colorWithWhite:1.0 alpha:0.5]];
[self.textLabel setBackgroundColor:[UIColor clearColor]];
}
return self;
}
ちなみに、textLabelの背景色を透明にし忘れると、以下の画像のように妙な縦線というか境界が出てしまう。


「UITableViewCellを半透明にする」への1件のフィードバック
コメントは停止中です。