1

2 つの UITextView で「autoresizingMask」に問題があります。2 つの UITextView のサイズを変更すると、最初のものが 2 番目の上に重なります。問題を説明するために画像を添付しました。

ありがとう!

ここに画像の説明を入力

更新:レヴナントコードを入れました

[UIビュー]

self.autoresizesSubviews = YES;

// Configure title label
_titleLabel = [[UILabel alloc] init];
_titleLabel.frame = CGRectMake(4.0, 4.0, self.bounds.size.width - 8.0, 33.0);
_titleLabel.backgroundColor = APP_COLOR(1.0);
_titleLabel.font = FONT_LATO_BOLD(18.0);
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.textAlignment = UITextAlignmentCenter;
[self addSubview:_titleLabel];

// Question textView
_questionTextView = [[UITextView alloc] initWithFrame:CGRectMake(0.0, 0.0, CGRectGetWidth(_titleLabel.bounds), (usableHeight / 2.0) - 4.0)];
_questionTextView.layer.cornerRadius = 8.0;
_questionTextView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin;
[self addSubview:_questionTextView];    

// Answer textView
_answerTextView = [[UITextView alloc] initWithFrame:CGRectMake(CGRectGetMinX(_questionTextView.frame), CGRectGetMaxY(_questionTextView.frame) + 8.0, CGRectGetWidth(_questionTextView.bounds), (usableHeight / 2.0) - 4.0)];
_answerTextView.layer.cornerRadius = 8.0;
_answerTextView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin;
[self addSubview:_answerTextView];
4

1 に答える 1

0

自動サイズ変更は正常に機能しています。

2 つのビューは、親ビューに収まりません。

ビューの高さを手動で調整する必要があります。

于 2013-10-30T22:10:14.173 に答える