开发者

UITableViewCell with a UITextView inside - scrolls even when disabled!

开发者 https://www.devze.com 2023-03-05 23:25 出处:网络
I am creating a table view cell with a text view inside and my problem is that I do not want the text view to scroll when it becomes first responder.

I am creating a table view cell with a text view inside and my problem is that I do not want the text view to scroll when it becomes first responder.

I have set scrollEnabledto NO and that avoids scrolling most of the time. But when the text view is completely filled up with text (I do not allow the user to enter more text than the text view can contai开发者_运维技巧n without scrolling) it scrolls up a bit when it becomes first responder.

How can that be avoided? :/

Thanks a lot,

Stine


You can determine where the text view will scroll to when it becomes first responder by setting the selected range.

Setting it like this:

[textView setSelectedRange:NSMakeRange(0, 0)];

will keep the text view scrolled to the top.

0

精彩评论

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