I wonder if anyone else is facing the same issue. I have a UITextView field placed in a UITableViewCell. Sometimes it does not displays the text. When i click or scroll the table view, it appears. Any guesses?
Details:
I call a method in viewDidLoad method that calls a web service to retrieve some data. On receiving the data, i set the values of UILabel and UITextView. UILabel values appear fine, but the UITextView (sometimes) do not show the value until i move to subview or scroll up and down to revisit the area contaning UITextView. I'm showing UILabel and UITextView objects in UITableViewCell. I call [tableView reloadData] right after setting values in UILabel and UITextView, but i do not re-create the UITableViewCell.
Thanks for your reply and pointers.
I solved this by calling [myTableView reloadData];
I had this same problem more or less - a UITextView inside a custom UITableViewCell subclass would not display its text until you touched (and thus scrolled) the UITextView. This would only happen with the FIRST cell in the table. I couldn't figure out why it was happening, but the problem was easily fixed by just "nudging" the UITextView's contentOffset programmatically.
problemCell.textView.contentOffset = CGPointMake(0.0, 1.0);
problemCell.textView.contentOffset = CGPointMake(0.0, 0.0);
This might have something to do with the fact that UITextView and UITableView are both subclasses of UIScrollView. So you have a scroll view inside of a scroll view, and it wouldn't surprise me if that was the cause of your problems.
If you don't need to edit the text within the table, just use a multi-line UILabel.
If you absolutely have to have a UITextView inside a UITableView, perhaps disabling scrolling on one of them might also fix the problem. (I think the property name is scrollEnabled
or scrollingEnabled
.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With