I have a UITextView
in subview of UIView
.I will change the texview height based on the text in the method textViewDidChange . My thought is when the text view height under goes to inside the keyboard i cant visible the entering text in the textview. How can solve the issue textview
text range over to the keyboard. How to make the entered text to appear for user.
我在UIView的子视图中有一个UITextView。我将根据textViewDidChange方法中的文本更改texview高度。我的想法是当文本视图高度进入键盘内部时,我无法看到在textview中输入文本。如何解决问题textview文本范围到键盘。如何使输入的文本显示给用户。
3 个解决方案
#1
1
You can check the size of your text with the font like this:
您可以使用以下字体检查文本的大小:
[@"MYString" sizeWithFont:myFont];
Knowing this, you can compare it with the size of the textview and now when your text is bigger!
知道这一点,你可以将它与textview的大小进行比较,现在你的文字更大!
#2
0
Move the textview up when it reaches the keyboard, or lower the font size when the text exceeds the maximum textview size.
到达键盘时向上移动文本视图,或者在文本超出最大文本视图大小时降低字体大小。
#3
0
Take this UITextView
in UIScrollView
and then set content size with the contentSize of UITextView
and scroll the UIScrollView
at bottom
在UIScrollView中使用此UITextView,然后使用UITextView的contentSize设置内容大小,并在底部滚动UIScrollView
set content size like bellow..
设置内容大小如下...
float sizescrollview = yourTextView.frame.origin.y + yourTextView.frame.size.height + 20;
scrview.contentSize=CGSizeMake(320, sizescrollview);
and scroll the UIScrollView
above of the keyboard like bellow..
并滚动键盘上方的UIScrollView,如下所示..
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
scrView.frame = CGRectMake(0, -150, 320, scrView.frame.size.height);
[UIView commitAnimations];
i hope this help you...
我希望这有助于你......
#1
1
You can check the size of your text with the font like this:
您可以使用以下字体检查文本的大小:
[@"MYString" sizeWithFont:myFont];
Knowing this, you can compare it with the size of the textview and now when your text is bigger!
知道这一点,你可以将它与textview的大小进行比较,现在你的文字更大!
#2
0
Move the textview up when it reaches the keyboard, or lower the font size when the text exceeds the maximum textview size.
到达键盘时向上移动文本视图,或者在文本超出最大文本视图大小时降低字体大小。
#3
0
Take this UITextView
in UIScrollView
and then set content size with the contentSize of UITextView
and scroll the UIScrollView
at bottom
在UIScrollView中使用此UITextView,然后使用UITextView的contentSize设置内容大小,并在底部滚动UIScrollView
set content size like bellow..
设置内容大小如下...
float sizescrollview = yourTextView.frame.origin.y + yourTextView.frame.size.height + 20;
scrview.contentSize=CGSizeMake(320, sizescrollview);
and scroll the UIScrollView
above of the keyboard like bellow..
并滚动键盘上方的UIScrollView,如下所示..
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
scrView.frame = CGRectMake(0, -150, 320, scrView.frame.size.height);
[UIView commitAnimations];
i hope this help you...
我希望这有助于你......