以下のように、テキストビューをコンテンツのサイズに拡大しています
CGRect _frame = descriptionText.frame;
_frame.size.height = descriptionText.contentSize.height;
descriptionText.frame = _frame;
コンテンツがビューを超えており、下にスクロールしてテキストを表示できませんでした。
スクロールビューのサイズをこんな風に設定してみた
scrollView.contentSize = CGSizeMake(295,_frame.size.height);
しかし、スクロールに失敗しますが、このような数値を指定すると機能します
scrollView.contentSize = CGSizeMake(295,600);
スクロール ビューのサイズを動的なコンテンツのサイズに設定する必要があります。どうやってやるの?
説明テキストを編集
CGRect descriptionTextViewRect = CGRectMake(15, 185, 280, 85);
descriptionText = [[UITextView alloc] initWithFrame:descriptionTextViewRect];
descriptionText.textAlignment = UITextAlignmentLeft;
descriptionText.text =offerdes;//this is the text fetched from an xml and is dynamic.
descriptionText.editable = NO;
descriptionText.layer.cornerRadius = 5.0;
descriptionText.clipsToBounds = YES;
descriptionText.userInteractionEnabled = YES;
descriptionText.font = [UIFont systemFontOfSize:15];
[scrollView addSubview: descriptionText];
[descriptionText release];