【问题标题】:UITextView can't see from top [duplicate]UITextView 从顶部看不到 [重复]
【发布时间】:2015-09-21 04:21:12
【问题描述】:

UITextView的内容过多时,光标的位置在中间而不是开头。我想从头开始,而不是从中间开始。

【问题讨论】:

    标签: ios uitextview


    【解决方案1】:

    试试这个,[yourTextView setSelectedTextRange:[yourTextView textRangeFromPosition:requiredCursorPosition toPosition:requiredCursorPosition]];

    更多请参考: https://stackoverflow.com/a/11532718/3743322

    【讨论】:

    • -(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; CGFloat contentHeight = self.textView.contentSize.height; CGFloat offSet = self.textView.contentOffset.x; CGFloat contentOffset = contentHeight - offSet; self.textView.contentOffset = CGPointMake(0, -contentOffset);我已经解决了,谢谢你了
    猜你喜欢
    • 2016-08-11
    • 2016-03-19
    • 1970-01-01
    • 2015-03-19
    • 2017-05-18
    • 1970-01-01
    • 2013-07-28
    • 2014-11-20
    • 1970-01-01
    相关资源
    最近更新 更多