键盘出现时如何使UITextView可滚动? [英] How to make an UITextView scrollable when the keyboard appears?

查看:80
本文介绍了键盘出现时如何使UITextView可滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在编辑UITextView时如何使其滚动?当用户想要对其进行编辑时,将显示键盘,但是UITextView不再是可滚动的.因此,键盘后面的所有文本都不可见.

I would like to know how I can make my UITextView scrollable when it's being edited ? When the user wants to edit it, the keyboard shows but then the UITextView is no more scrollable. So all the text behind the keyboard is not visible.

推荐答案

您可以减小keyOfard上出现的textOf大小

You can reduce sizeOf you textView on keyBoard appear

-(void)textViewDidBeginEditing:(UITextView *)textView
{
    CGRect frame = txtAddNote.frame;
    frame.size.height = 150; //Decrease your textView height at this time
    txtAddNote.frame = frame;
}
-(IBAction)DoneBarBtnPress:(id)sender
{
    CGRect frame = txtAddNote.frame;
    frame.size.height = 212; //Original Size of textView
    txtAddNote.frame = frame;

    //Keyboard dismiss 
    [self.view endEditing:YES];
}

这篇关于键盘出现时如何使UITextView可滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆