您的位置:首页 > 移动开发 > IOS开发

ios键盘高度

2013-04-03 11:08 267 查看
- (void)viewDidLoad
{
[super viewDidLoad];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
[[NSNotificationCenter defaultCenter]removeObserver:self];
}
-(void)keyboardWillShow:(NSNotification*)notification{

NSDictionary*info=[notification userInfo];
CGSize kbSize=[[info objectForKey:UIKeyboardFrameEndUserInfoKey]CGRectValue].size;
//
NSValue *animationDurationValue = [info objectForKey:UIKeyboardAnimationDurationUserInfoKey];

NSTimeInterval animationDuration;

[animationDurationValue getValue:&animationDuration];
NSLog(@"keyboard changed, keyboard width = %f, height = %f,animationDuration =%f",

kbSize.width,kbSize.height,animationDuration);

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: