获取键盘高度
来源:互联网 发布:怎么研发软件 编辑:程序博客网 时间:2024/05/16 12:40
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.titleTextField.delegate = self;
self.contextTextView.delegate = self;
//增加监听,当键盘出现或改变时收出消息
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
//增加监听,当键退出时收出消息
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
}
//当键盘出现或改变时调用
- (void)keyboardWillShow:(NSNotification *)aNotification
{
//获取键盘的高度
NSDictionary *userInfo = [aNotification userInfo];
NSValue *aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
CGRect keyboardRect = [aValue CGRectValue];
int height = keyboardRect.size.height;
}
//当键退出时调用
- (void)keyboardWillHide:(NSNotification *)aNotification
{
}
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.titleTextField.delegate = self;
self.contextTextView.delegate = self;
//增加监听,当键盘出现或改变时收出消息
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
//增加监听,当键退出时收出消息
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
}
//当键盘出现或改变时调用
- (void)keyboardWillShow:(NSNotification *)aNotification
{
//获取键盘的高度
NSDictionary *userInfo = [aNotification userInfo];
NSValue *aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
CGRect keyboardRect = [aValue CGRectValue];
int height = keyboardRect.size.height;
}
//当键退出时调用
- (void)keyboardWillHide:(NSNotification *)aNotification
{
}
0 0
- 获取键盘的高度
- ios 获取键盘高度
- andorid 获取键盘高度
- 获取键盘高度
- 获取键盘高度
- iOS获取键盘高度
- 通知,获取键盘高度
- IOS获取键盘高度
- 获取键盘的高度
- 获取键盘高度
- 动态获取键盘高度
- <iOS>获取键盘高度
- iOS获取键盘高度
- 获取键盘高度
- iOS 获取键盘高度
- 获取键盘高度
- iOS 获取键盘高度
- iOS获取键盘高度
- 等额本金和等额本息的区别(含计算公式)
- zookeeper超时--minSessionTimeout与maxSessionTimeout
- 大话重构连载1:遗留系统——软件工业时代的痛
- 常用正则表达式(收藏整理)
- Android系统启动过程
- 获取键盘高度
- ios录音功能的实现
- I2C上拉电阻取值问题
- textView 文字居上
- 写给年轻程序员的一封信
- appStore检查版本更新与从app里跳到appstore评论页面
- 共享内存
- java 内省操作bean
- Unity3d-游戏中的小地图制作