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:
- the user selects a note from a table in the parent view controller.
- the parent view controller sets the textview.text property so my UITextView will know what text to show.
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 :
Maybe simply try