contentViewの背後にUITableViewセパレーターを非表示にする
-
07-07-2019 - |
質問
左の画像のように見えるグループ化されたiPhone OS 3.0のUITableViewを作成しました。結果はOS 3.1の正しい画像です。
imageViewはセパレータの下にあります。
コンテンツビューを前面に配置しようとしました。 tableViewがグループ化されたスタイルの場合(セパレーターを自分で描画するため)、separatorStyleプロパティは無視されるようです。セパレータの色を変更すると、文字列の結果が得られます。
ご協力ありがとうございます!
編集:これは変更が加えられていないコードです:
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.textLabel.font = [UIFont boldSystemFontOfSize:18.0];
}
cell.textLabel.text = [[metro.arretDirection objectAtIndex:indexPath.row] name];
NSString* name;
if (indexPath.row == 0) {
name = @"Begining";
}
else if (indexPath.row + 1 == [metro.arretDirection count]) {
name = @"End";
}
else {
if ([[[metro.arretDirection objectAtIndex:indexPath.row] lines] count]== 1) name = @"Little";
else name = @"Big";
}
UIImage* metroImage = [[UIImage alloc] initWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:[NSString stringWithFormat:@"%i%@.png", metro.metroNumber, name]]];
cell.imageView.image = metroImage;
[metroImage release];
return cell;
解決 2
実際の答えは非常に単純で、組み込みのimageViewを使用する代わりに、セルに UIImageView
を適切に追加するだけです。
他のヒント
セルで clipsToBounds をNOにします。例: cell.clipsToBounds = NO;
所属していません StackOverflow