键盘覆盖Notes App中的UITextView [英] Keyboard covering UITextView in Notes App

查看:46
本文介绍了键盘覆盖Notes App中的UITextView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在做一个笔记应用程序,但遇到了一个大问题.我正在使用UITextView作为记事本.键盘抬起时,它将阻止UITextView中的某些文本.我在UITextView上有一个输入附件视图.我试图在互联网上找到答案,却找不到一个好的答案.有什么办法可以解决?这是一张图片:

Hi guys I am making a notes app and I ran into a big problem. I am using a UITextView as the notepad. When the keyboard comes up it blocks some of the text in the UITextView. I have a input accessory view on the UITextView. I tried to find the answer in the internet and can not find a good answer.Any way to fix it? Here is a picture:

推荐答案

我决定用键盘高度减去UITextView高度:

I decided to subtract the UITextView height by the keyboard height:

NSDictionary* info = [notification userInfo];
kbSIZE = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
CGRect newTextViewFrame = self.notesTextView.frame;
newTextViewFrame.size.height -= kbSIZE.size.height;
newTextViewFrame.size.height += self.notesTextView.inputAccessoryView.frame.size.height;
self.notesTextView.frame = newTextViewFrame;

这篇关于键盘覆盖Notes App中的UITextView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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