uiviewcontroller 键盘不遮挡信息
//添加监听事件
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; //监听回调
#pragma mark - keyboard
- (void)keyboardWillShow:(NSNotification*)notification { CGRect frame = self.view.frame;
frame.origin.y -= ;
//frame.size.height +=216;
// Shrink view's inset by the keyboard's height, and scroll to show the text field/view being edited
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:[[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue]];
[UIView setAnimationDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]];
self.view.frame = frame;
[UIView commitAnimations];
} - (void)keyboardWillHide:(NSNotification*)notification { CGRect frame = self.view.frame;
frame.origin.y += ;
//frame.size.height -=216;
//self.view移回原位置
// Restore dimensions to prior size
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:[[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue]];
[UIView setAnimationDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]];
self.view.frame = frame;
[UIView commitAnimations];
}
uiviewcontroller 键盘不遮挡信息的更多相关文章
- Java基础知识强化之IO流笔记51:IO流练习之 键盘录入学生信息按照总分排序写入文本文件中的案例
1. 键盘录入学生信息(姓名,语文成绩,数学成绩,英语成绩),按照总分排序写入文本文件中 分析: A:创建学生类 B:创建集合对象 TreeSet<Student> ...
- H5输入框在输入信息的时候 页面会变形 并且在页面不变形的时候 键盘会遮挡 输入框的解决办法
$(document).ready(function () { $('body').css({'height':$(window).height()})});//这行是解决输入框在输入信息弹出键盘后页 ...
- Android WebView中软键盘会遮挡输入框相关问题
要想实现这样的软键盘出现的时候会自己主动把输入框的布局顶上去的效果,须要设置输入法的属性,有下面两种设置方式: 一.在java代码中设置例如以下: getWindow().setSo ...
- IO流(1)-键盘录入学生信息(姓名,语文成绩,数学成绩,英语成绩),按照总分从高到低存入文本文件
1.先写一个Student类 public class Student { private String name; private int chinese; private int math; pr ...
- ios 中键盘被遮挡解决方案
1.当view是非可以滚动的view时, // 添加对键盘的通知 - -(void)viewDidLoad{ [[NSNotificationCenter defaultCenter] addObse ...
- Swift - 键盘弹起,遮挡输入框
extension LoginViewController:UITextFieldDelegate { func textFieldShouldReturn(textField: UITextFiel ...
- android 软键盘不遮挡页面上的控件
只需要加android:windowSoftInputMode="adjustPan"就可以如: <activity android:name=".Enhance_ ...
- ZYKeyboardUtil 全自动处理键盘遮挡事件
键盘遮盖输入控件或按钮在日常app开发中避之不及,考虑各种情况下UI各种嵌套,最后还要注册监听再获取指定键盘信息.我们可以通过键盘处理工具类ZYKeyboardUtil避繁就简,利用Block的方式处 ...
- IO流的练习4 —— 键盘录入学生成绩信息,进行排序后存入文本中
需求: 键盘录入5个学生信息(姓名,语文成绩,数学成绩,英语成绩),按照总分从高到低存入文本文件 分析: A:创建学生类 B:创建集合对象 TreeSet<Student> C:键盘录入学 ...
随机推荐
- 关于git被误删除的分支还原问题
在开发过程中, 有可能会将正在开发的本地分支误删, 本地分支被删除时, 如果已经将本地分支的变更推送到了远端, 还没有问题, 如果被删除的本地分支只提交了没有推送到远端, 就悲剧了, 相当于在你上一次 ...
- Java简单的数组用法尝试,和C语言很不一样
public class Main { static int ARRY_LONGTH=100; static int[] getRandomArr(int n){ int[] randomArr; r ...
- LeetCode: 258 Add Digits(easy)
题目: Given a non-negative integer num, repeatedly add all its digits until the result has only one di ...
- spown mj
local function getmjvalnew(key) local keynew = {} local sumnval = 0 for _, v in ipairs(key) do if v& ...
- Linux whereis 搜索命令位置
在学习 兄弟连 linux教学视频 的时候,我将所学的 linux 命令记录在我的博客中,方便自己查阅. 文件搜索命令: whereis 基础的命令 命令名称:whereis 命令的所在路径:/usr ...
- Warning: The Copy Bundle Resources build phase contains
在编译程序时,遇到了这样的Waring: Warning: The Copy Bundle Resources build phase contains this target's Info.pl ...
- Exists 方法
public void ExistsMethodDemo() { string userId = "123"; string userName = "admin" ...
- Unity2016 Unity3D开发VR游戏的经验
http://z.youxiputao.com/articles/8313 在4月12日的Unite 2016大会上,暴风魔镜高级产品经理吴涛分享他用Unity3D开发VR游戏的经验,以下为分享实录: ...
- npm,cnpm,nrm区别
npm npm(node package manager)是nodejs的包管理器,用于node插件管理(包括安装.卸载.管理依赖等) nrm nrm只是单纯的提供了几个常用的下载包的uri地址,并能 ...
- 用css固定textarea文本域大小尺寸
textarea元素在chrome等浏览器下可以被拖拉从而改变大小,对于查看textarea里面的内容来说相当方便,但是有时候 我们为了保持网页的美观,不得不想要禁掉这个功能,禁止用户随意拉动text ...