uitableview 关于键盘挡住输入框解决方法
//
// AboutKeyBoardEventViewController.m
// QueryBussinessInfo
//
// Created by mac on 16/8/23.
// Copyright © 2016年 cqytjr. All rights reserved.
// #import "AboutKeyBoardEventViewController.h" @interface AboutKeyBoardEventViewController () @end @implementation AboutKeyBoardEventViewController - (void)viewDidLoad {
[super viewDidLoad];
self.tableView = [[UITableView alloc]initWithFrame:self.view.bounds];
[self.view addSubview:self.tableView];
//监听键盘弹出事件
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
//监听键盘隐藏事件
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
} -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 0;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
return nil;
} #pragma mark - 键盘即将弹出事件处理
- (void)keyboardWillShow:(NSNotification *)notification
{
//获取键盘信息
NSDictionary *keyBoardInfo = [notification userInfo]; //获取动画时间
CGFloat duration = [[keyBoardInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]; //获取键盘的frame信息
NSValue *value = [keyBoardInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
CGSize keyboardSize = [value CGRectValue].size; [UIView animateWithDuration:duration animations:^{
// CGRect frame = _chatBar.frame;
// frame.origin.y = SCREENHEIGHT - keyboardSize.height - frame.size.height;
// _chatBar.frame = frame;
CGRect rect = self.tableView.frame;
rect.size.height = keyboardSize.height;
self.tableView.frame = rect; } completion:nil];
}
#pragma mark - 键盘即将隐藏事件
- (void)keyboardWillHide:(NSNotification *)notification
{ //获取键盘信息
NSDictionary *keyBoardInfo = [notification userInfo]; //获取动画时间
CGFloat duration = [[keyBoardInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]; //获取键盘的frame信息 [UIView animateWithDuration:duration animations:^{ CGRect rect = self.tableView.frame;
rect.size.height = self.view.bounds.size.height;
self.tableView.frame = rect;
} completion:nil];
} - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} /*
#pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/ @end
uitableview 关于键盘挡住输入框解决方法的更多相关文章
- Android各种键盘挡住输入框解决办法
方法一:windowSoftInputMode:adjustResize和adjustPan 主要实现方法:在 AndroidManifest.xml 对应的Activity里添加 android:w ...
- android全屏/沉浸式状态栏下,各种键盘挡住输入框解决办法
https://blog.csdn.net/smileiam/article/details/69055963
- iOS 解决键盘挡住输入框的问题
iOS开发中经常会用到输入框UITextField,所以也常会遇到键盘挡住输入框而看不到输入框的内容. 在这里记录一种方法,用UITextField的代理来实现View的上移来解决这个问题. 首先设置 ...
- 【转】iOS 上常用的两个功能:点击屏幕和return退出隐藏键盘和解决虚拟键盘挡住UITextField的方法
iOS上面对键盘的处理很不人性化,所以这些功能都需要自己来实现, 首先是点击return和屏幕隐藏键盘 这个首先引用双子座的博客 http://my.oschina.net/plumsoft/blog ...
- h5软键盘挡住输入框问题解决(android)
问题 移动端浏览器中的表单在部分android机型上测试,点击靠下的输入框时会遇到弹出的软键盘挡住输入框问题 ios可自身弹起(ios自身的调整偶尔也会出问题,例如第三方键盘会遮挡,原因是第三方输入法 ...
- 【土旦】vue 解决ios H5底部输入框 获取焦点时弹出虚拟键盘挡住输入框 以及监听键盘收起事件
问题描述 im聊天H5页面,在iOS系统下,inpu获取焦点弹出系统虚拟键盘时,会出现挡住input的情况,十分影响用户体验. bug图 解决方法: html: <input type=&quo ...
- Android爬坑之旅:软键盘挡住输入框问题的终极解决方案
前言 开发做得久了,总免不了会遇到各种坑.而在Android开发的路上,『软键盘挡住了输入框』这个坑,可谓是一个旷日持久的巨坑--来来来,我们慢慢看. 入门篇 Base 最基本的情况,如图所示:在页面 ...
- Android WebView 软键盘挡住输入框
解决方法一: 在所在的Activity中加入 getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RES ...
- ubuntu桌面右上角键盘图标不见解决方法
今天出现了这个问题,桌面右上角的键盘图标不见,找到解决方法如下: 打开终端,分别输入以下命令即可: killall ibus-daemon 这个表示结束进程 ibus-daemon -d 这个表示重启 ...
随机推荐
- 利用Runtime给UITextView添加占位符(新方法)
以前一直使用自定义UITextView通过通知中心来自定义placeHolder,最近看到这个方法,感觉更好 UITextView *textView = [[UITextView alloc]in ...
- ora2pg数据迁移
1.安装strawberry-perl-5.242.安装ora2pg-17.4 #perl Makefile.PL #dmake && dmake install3.安装ora2pg相 ...
- Java中 +=是什么意思 什么情况下用
x+=1与x=x+1一样的效果执行一次x=x+1,就等于给x重新赋了值,这个值就是x+1例如:int x=1;x+=1;最后x的值是2x+=1一般在循环下使用,能发挥它的最大的作用.例如:while( ...
- docker命令和后台参数
Docker官方为了让用户快速了解Docker,提供了一个 交互式教程 ,旨在帮助用户掌握Docker命令行的使用方法. Docker 命令行 下面对Docker的命令清单进行简单的介绍,详细内容在后 ...
- (repost)在ARM Linux内核中增加一个新的系统调用
实验平台内核版本为4.0-rc1,增加一仅仅打印Hello World的syscall,最后我们在用户空间swi验证 实验平台内核版本为4.0-rc1,增加的系统调用仅仅是简单打印一个Hello Wo ...
- angularjs各版本下载
下载网址:https://code.angularjs.org/1.2.14/
- SSH整合例子
三大框架: Struts框架 1. params拦截器: 请求数据封装 2. 类型转换/数据处理 3. struts配置 4. 文件上传/下载/国际化处理 5. 数据效验/拦截器 6. Ognl表达式 ...
- Layui文件上传样式在ng-dialog不显示的问题处理
1.项目业务改动,在一个弹窗页面加图片上传. 2.页面使用angular框架,图片上传使用layui的文件上传组件. js: layui.upload({ url: '/test/upload.jso ...
- 自定义按钮~自适应布局~常见bug
一.元件 自定义按钮可用button或a display为 inline-block 方便设置格式,通过 padding,height,line-height,font-size设置按钮的大小 & ...
- Java web项目综合练习(Estore)
Java web项目综合练习(Estore) 复习day18: ajax代码的书写步骤 2)json格式文本,转js对象的方法是那个 项目开发流程介绍 这里学习的JavaWEB项目实战,主要是把前面学 ...