I have a UITextView in which the user enters lines of text. After the entry of the text I take a screen capture. Problem is, if you enter more than visible lines in textView,开发者_如何学JAVA you can't screen capture all the text. I tried disabling scrolling, but that makes it worse because text entry from keyboard makes the textview scroll into non-visible area and there's no way for the user to scroll text down again. Thanks in advance for your help.
UITextView is also a ScrollView, so you can use it's contentSize property to only allow text input if the text fits the textView like this:
-(BOOL) textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
// Only allow text input if the size of the content is smaller than the size of the textView
return (textView.contentSize.height < textView.bounds.size.height);
}
You will also need to disable the scrolling like you did, to make the UI look good.
精彩评论