UITableViewCell
init メソッドを持つサブクラスがあります。
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self setBackgroundColor:[UIColor whiteColor]];
[self.contentView setBackgroundColor:[UIColor whiteColor]];
CGFloat xOffset = 10.0;
CGFloat lineWidth = 1.0;
UIView *footerLine = [[UIView alloc] initWithFrame:CGRectMake(xOffset,
self.frame.size.height - lineWidth,
self.frame.size.width - xOffset,
lineWidth)];
[footerLine setBackgroundColor:[UIColor redColor]];
[footerLine setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin];
[self addSubview:footerLine];
}
return self;
}
そこで、セルの下部に線を引こうとしています (x 方向に少しずらして)。これはテーブルの読み込み時にうまく描画されますが、デバイスを横向きに回転させてから再び元に戻すと、footerLine ビューが失われます。
これは次の行と関係があると感じています。
[footerLine setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin];
しかし、列挙型の複数の組み合わせをUIViewAutoresizing
いじってしまい、ローテーション後に再表示できません。
UIViewAutoresizing
??に欠けている可能性のあるものはありますか?