私はRoundedRectView内にUILabelViewを持っています。 UILabelViewは動的に生成されたテキスト文字列に新しい行があることを示しています。新しい行でUILabelViewの表示テキストを作成するには?
問題は、UILabelがテキストを "blahblahbla ..."と表示していて、複数の行にテキストを表示していないように見えることです。唯一の例外は、その時点で「sizeToFit」関数呼び出しを行うと、親ビューの中央にテキストが表示されなくなります。私はUILabelViewの行数を0にして、親ビュー(RoundedRectView)のフレームを増やしました
これを避けるにはどうしたらいいですか?
CGRect frame = [self.messageView frame]; //get the frame size of parent view
self.messageView.frame = CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, (lineHeight * count)); //increase it to fit the text
self.messageLabel.text = message;
[self.messageView setNeedsDisplay];
// [self.messageLabel sizeToFit]; this fixes the multiple line issue but now label is not centered in parent view
私は既にそれをしました。 – jini