その各セルにサブビューとして追加されたaがありUITableView
ます。UIImage
画像はPNG透明です。問題は、をスクロールするUITableView
と、画像が重なって、メモリの警告などが表示されることです。
セルを構成するための現在のコードは次のとおりです。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
int cellNumber = indexPath.row + 1;
NSString *cellImage1 = [NSString stringWithFormat:@"c%i.png", cellNumber];
UIImage *theImage = [UIImage imageNamed:cellImage1];
UIImageView *cellImage = [[UIImageView alloc] initWithImage:theImage];
[cell.contentView addSubview:cellImage];
return cell;
}
UIImage
サブビューを削除するためのコードは次のようになります。
[cell.imageView removeFromSuperview];
でもどこに置けばいいのかわからない。すべての行の間に配置しました。ifステートメントにelseを追加しました。うまくいかなかったようです!