0

これは現在私のセルがどのように見えるかです:http ://tinypic.com/view.php?pic = 344uz2a&s = 6

ご覧のとおり、何らかの理由で、セルの右側の部分をbackgroundColor白で塗りつぶすことを拒否しています。そして、なぜ、または何が問題なのか、私にはわかりません。

これが、TableView/Cellsを実装した方法です。viewDidLoadで、tableView全体をclearColorに設定して、「emptyCells」を非表示にします。

- (void)viewDidLoad{

 self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
 tableView.backgroundColor = [UIColor clearColor];
}

以下の方法では、セルのbackgroundColorを設定しようとしています。残念ながら、上記のように、セル内でwhiteColorを右側に設定することを拒否します。

- (UITableViewCell *)tableView:(UITableView *)pTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"SearchCell";
UITableViewCell *cell = [pTableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil)
{
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault  reuseIdentifier:CellIdentifier];
}
Task *task = [self.searchResults objectAtIndex:indexPath.row];

UILabel *nameLabel = (UILabel *)[cell viewWithTag:1];
UILabel *bookLabel = (UILabel *)[cell viewWithTag:2];
UILabel *chapterLabel = (UILabel *)[cell viewWithTag:3];

[nameLabel setText:task.name];
[bookLabel setText:task.book.name];
[chapterLabel setText:task.chapter.name];

cell.backgroundColor =  [UIColor whiteColor];
cell.contentView.backgroundColor =  [UIColor whiteColor];
cell.backgroundView.backgroundColor = [UIColor whiteColor];

return cell;
}

何か案は?この「色」の問題を解決するために、私は何を見逃しましたか、または何ができますか?よろしくお願いします

4

2 に答える 2

1

アクセサリビューの背景色も次のように設定する必要があるようです。

self.accessoryView.backgroundColor = [UIColor whiteColor];

背景ビューの境界を調べてみると、おそらくテーブルセル全体にまたがっていません。

于 2012-10-15T16:23:59.770 に答える
0

試す

cell.backgroundView.backgroundColor = [UIColor whiteColor];

また

cell.backgroundView.layer.backgroundColor = [UIColor whiteColor].CGColor;
于 2012-10-15T16:19:22.813 に答える