views:

1073

answers:

1

I have a UITextView that I am appending texts to from time to time, but I am unable to find an API that tells me whether the text I am appending is out of view or not so I can send a scrollToRange message to UITextView. Is there a way to do this?

+1  A: 

Check content size every time when you add text

UITextView *textView;
    if(textView.contentSize.height > textView.frame.size.height)
    {
     //your text is lager then view
    }
oxigen
This works fine for the first time the content height exceeds the frame. After that the condition stays true with every character added to the line, and the text view will keep scrolling. What I am looking for is for a test case to pass only when the text added is out of view.
Boon
try this if((textView.contentOffset.y + textView.frame.size.height) < textView.contentSize.height)
oxigen