0
我有我的行項目的UITableView圖像暗背景被初始化爲默認的UITableViewCell(所有者文件是委託並表的數據源):在默認情況下的UITableViewCell
- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
[cell setSelectionStyle:UITableViewCellSelectionStyleGray];
switch (indexPath.row) {
case 0:
cell.imageView.image = [UIImage imageNamed:@"icon_facebook.png"];
cell.textLabel.text = kShareFacebook;
break;
case 1:
cell.imageView.image = [UIImage imageNamed:@"icon_twitter.png"];
cell.textLabel.text = kShareTwitter;
break;
case 2:
cell.imageView.image = [UIImage imageNamed:@"icon_clipboard.png"];
cell.textLabel.text = kShareClipboard;
break;
default:
break;
}
return cell;
}
這一切工作正常然而當顯示錶,圖像被顯示在較暗的背景和有沿着行的右邊緣較暗的餘量,如可在此圖像中可以看出: 我試圖使用以清除該背景一些/所有的組合:
[cell setBackgroundColor:[UIColor whiteColor]];
[cell.imageView setBackgroundColor:[UIColor whiteColor]];
[cell setIndentationLevel:1];
[cell setOpaque:YES];
但是這沒有幫助。我如何擺脫黑暗的背景,讓整個細胞出現在白色背景上?
您是否使用IB來設置UITableView? – Mutix 2011-12-15 10:30:27