开发者

UITextView keep scrolling after every new line is inserted, so the lines are invisible (iPhone OS)

I have UITextView and a situation that is problematic. I write line of text in the UITextView, and then press return for new line. What happen is, the line that i entered is moving up so i can't see it, and i am able to continue writing. This is bad behavior for me, because i need the line to stay, and only move up when 开发者_高级运维i reach the bottom of the UITextView.

  • I've read other similar posts but they wasn't helpfull.

Is someone familiar with this thing?


I had luck using this solution: How to stop UITextView from scrolling up when entering it

However, I also found depending on the size of my UITextView, the insets needed to get it to scroll correctly varied and subclassing wasn't always necessary. For instance, for a text view of height 40 (very small for a UITextView), I did the following:

textView_ = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 300, 40)];
textView_.contentInset = UIEdgeInsetsMake(-6, -8, 0, 0);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜