【发布时间】:2014-05-06 02:57:19
【问题描述】:
我正在使用此代码制作具有自动调整大小的动态 UITextView
- (void)textViewDidChange:(UITextView *)txtView
{
CGRect frame;
frame = txtView.frame;
frame.size.height = [textView contentSize].height;
textView.frame = frame;
}
代码很好,但是当我在键盘上按“return”(断线)时,我需要 textView 向上增长,而不是像现在这样向下。
我尝试使用“CGRectGetMaxY(textView.frame)”做一些事情,因为我知道 textView 的底部需要保持不变,但我没有找到正确的方法。
这个textView是用来输出聊天消息的,所以如果用户写的东西很长,textView需要长大,因为键盘在下面
【问题讨论】:
标签: ios objective-c uitextview