I am using a UIScrollView to create the illusion of lined paper behind my UITextView (I have to use a separate UIScrollView so I can have margins). In order to draw the paper with the correct number of lines, I need to pass it the contentSize.height
of the UITextView.
Here is what happens at the moment:
If I set up my UIScrollView in viewWillAppear
, it won't work because textView.text has not been set yet, so the textView.contentSize.height is zero. But if I set it up in viewDidAppear
, although it works, the lines appear a moment after the text.
What is the right way of going about this?
Simply try to set the property before pushing the child view controller.
I assume that your code is something like in the parent view controller :
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UIViewController* childViewController = ...
[self.navigationController pushViewController:childViewController animated:YES];
childViewController.text = ...
[childViewController release];
}
Maybe simply try
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UIViewController* childViewController = ...
childViewController.text = ...
[self.navigationController pushViewController:childViewController animated:YES];
[childViewController release];
}