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:键盘录入学 ...
随机推荐
- Android开发--数据存储之数据库操作
简介: SQLite 的介绍: SQLite数据库属于文本型的数据库,它是以文本的形式来保存的.Android提供了对 SQLite 数据库的完全支持,应用程序中的任何类都可以通过名称来访问任何的数据 ...
- jQuery 学习笔记(一)jQuery 语法
jQuery 是一个 JavaScript 库,极大地简化了 JavaScript 编程,很容易学习 添加 jQuery 库 <head> <script type="te ...
- lightoj 1422【区间DP·分类区间首元素的情况】
题意: 给你n天分别要穿的衣服种类,可以套着穿, 一旦脱下来就不能再穿,求n天至少要几件. 思路: 区间DP dp[i][j]代表i到j需要至少几件衣服 第i天的衣服在第i天穿上了,dp[i][j]= ...
- HDU5894【组合数学】
题意: 现在 m个考生人需要坐在有n个座位的圆桌上. 你需要安排位置,使得任意两个考生之间相距至少k个位置. 桌子有编号,考生a和b交换位置视作一种方案,问有多少方案,mod 1e9+7. (0 &l ...
- 微信小程序取消button边框线
先给button定义个class属性 <button class="an"> 按钮 </button> 然后再css上加上 .an::after { bor ...
- 换装demo随手记
1 修补demo错误,使VirtualWorldExample可正常运行 CharacterGenerator.AssetbundleBaseURL 做如下修改 public static strin ...
- luoguP3808[模板]AC自动机(简单版)
传送门 ac自动机模板题,裸的多串匹配 代码: #include<cstdio> #include<iostream> #include<algorithm> #i ...
- HDU6308(2018多校第一场)
Bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6308 将时间化简为分钟计算,同时不要用浮点数计算,精度会出现问题: 如果采用精度,最好加 ...
- 2017"百度之星"程序设计大赛 - 资格赛 度度熊的王国战略
度度熊的王国战略 度度熊国王率领着喵哈哈族的勇士,准备进攻哗啦啦族. 哗啦啦族是一个强悍的民族,里面有充满智慧的谋士,拥有无穷力量的战士. 所以这一场战争,将会十分艰难. 为了更好的进攻哗啦啦族,度度 ...
- 【aspnetcore】异常捕捉可用知识点
1.使用过滤器ExceptionFilter:补充:常用过滤器:AuthorizationFilter.ActionFilter.ResultFilter.ResourceFilter.Excepti ...