1

これが私のアプリの画像です

私のアプリの画像

ご覧のとおり、各行に白い線があります。どうすればその線から抜け出すことができますか。

これが私が行ったセルのコードです

cell.backgroundView = [ [[UIImageView alloc] initWithImage:[ [UIImage imageNamed:@"conta.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:5.0] ]autorelease];   
cell.textLabel.backgroundColor=[UIColor clearColor];
cell.textLabel.text = [tableArray objectAtIndex:indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
tableView.backgroundColor=[UIColor clearColor];
return cell;

各行の白い線を消す必要があります。どうやってやるの?

4

4 に答える 4

7

テーブルビューのセットアップ中のどこかで、セパレータスタイルを「なし」に設定できます。これは、InterfaceBuilderのストーリーボード/ペン先で実行することも、次のようなコードで実行することもできます。

[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
于 2012-07-05T17:14:20.043 に答える
1

これには次のコードを使用できます。

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.separatorColor = [UIColor clearColor];
于 2012-07-05T17:16:02.817 に答える
1

xib uでは、セパレータースタイルを選択できます。これにより、白い線が表示されなくなります

cell.backgroundView = [ [[UIImageView alloc] initWithImage:[ [UIImage imageNamed:@"conta.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:5.0] ]autorelease];   
cell.textLabel.backgroundColor=[UIColor clearColor];
cell.textLabel.text = [tableArray objectAtIndex:indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
tableView.backgroundColor=[UIColor clearColor];
return cell;
于 2012-07-05T17:19:15.327 に答える
1

セルを小さくしたためにセルの高さが十分でない場合でも、テーブルまたはテーブルでセルを小さく設定するのを忘れた場合

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;

または、セルの間に背景を表示できるようにセルの間に少しスペースを残したかったので、実際に表示されるのはテーブル自体の「白」です。

デフォルトでは、UITableViewsは白一色であるため、セル間に背景を表示する場合は、テーブルを「不透明ではない」に設定し、背景色をクリアカラーに設定する必要があります。

于 2012-11-12T22:21:56.753 に答える