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:键盘录入学 ...
随机推荐
- 怎么在Ubuntu下设置程序的快捷键
参考 http://jingyan.baidu.com/article/1e5468f97f9e75484861b773.html 我的系统是 64bit Ubuntu14.04 我设置了 gedit ...
- 3.4-3.6 依据业务需求分析HBase的表设计
一.依据[话单]查询需求分析HBase的表设计 1.分析 用户需要进行实时的查询,那么这些数据是放在HBase当中的,每个客户每天接打电话至少20个左右,而通信公司拥有很多用户,每天产生的数据都是上亿 ...
- TypeScript完全解读(26课时)_18.Mixins混入
本节的代码在mixin.ts文件内 同时在index.ts内引入 混入就是把两个对象或者类的内容混合到一起,从而实现一些功能复用. 对象混入 js中对象的混入 先来看一个js中对象的混入的例子 首先定 ...
- Identity Server 4 原理和实战(完结)_Implicit Flow 实例
oidc-client.js貌似是IdentityServer4的团队开发的 服务端的设置 在服务端新增一个Client 之后需要在angular客户端页建两个页面,对应这两个url才行 登出之后要跳 ...
- supervisor 启动 celery 及启动中的问题
一.前言 本教程重点在于supervisor的配置过程,celery的安装配置请参考其他教程 二.安装supervisor 1.安装命令 pip install supervisor # superv ...
- 在junit格式的结果信息中只包含错误信息的修改方法
文件名称:suiteJunit.vm 文件路径:src\fitnesse\resources\templates 添加如下黑体部分内容: <?xml version="1.0" ...
- Sping中使用Junit进行测试
分析: 1.应用程序的入口 main方法2.junit单元测试中,没有main方法也能执行 junit集成了一个main方法 该方法就会判断当前测试类中哪些方法有 @Test注解 junit就让有Te ...
- test markdown style
code // Forward declaration of isBadVersion API. bool isBadVersion(int version); class Solution { pu ...
- PJzhang: github与出口管制·说明条款
猫宁!!! 参考链接:https://www.infoq.cn/article/KMl2EO*PSMxIkVREiYvC https://help.github.com/en/articles/git ...
- Java 分析工具汇总
http://blog.csdn.net/fenglibing/article/details/6411999 jps jps -mlvV jmap jmap -heap <pid> ...