次のような単純なカスタム UICellView を使用しています。
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
UIColor* color = [UIColor colorWithRed:204/255.0f green:62/255.0f blue:56/255.0f alpha:1.0f];
// Initialization code
//Styling the cell:
UIView* spacer = [[UIView alloc] initWithFrame:CGRectMake(40,200, 350, 100)];
[spacer setBackgroundColor:[UIColor colorWithRed:180/255.0f green:56/255.0f blue:61/255.0f alpha:1.0f]];
//
UIView* BlockNumber = [[UIView alloc] initWithFrame:CGRectMake(40,200, 179, 175)];
[BlockNumber setBackgroundColor:[UIColor whiteColor]];
[self.contentView addSubview:spacer];
[self.contentView addSubview:BlockNumber];
//
self.backgroundColor=color;
}
return self;
}
forループでセルのサブビューをチェックしようとしましたが、セルビュー内には表示されませんが、そこにあるようです。ただし、self.backgroundColor は実際には色を変更しますが、ビューを追加するとうまくいきません。
どんな助けでも大歓迎です。