gpt4 book ai didi

iOS 7 UITextView 错误

转载 作者:可可西里 更新时间:2023-11-01 06:09:51 24 4
gpt4 key购买 nike

我注意到在 iOS 7 中,到达底部后 UITextView 的最后一行总是隐藏的。当您向事件添加注释时,甚至会在日历应用程序中发生这种情况。

我试过设置 contentInsets 和 textContainerInset,它们都没有任何区别。

有没有其他人遇到过这个问题,如果有,是否有解决方法?

Calendar UITextView Bug

最佳答案

我有替代解决方案来解决这个问题:

  1. 在您的 ViewController 中实现 TextViewDelegate
  2. 为您的 textView 将委托(delegate)设置为 self
  3. 实现 textView:(UITextView *)textView shouldChangeTextInRange:

例子:

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
[textView scrollRangeToVisible:range];

return YES;
}

现在,运行您的代码,通过执行此操作,当您按“\n”(Enter)时,您的 curson 将不可见,但当您按下下一个字符时,它将使其可见。

关于iOS 7 UITextView 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19584813/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com