首页 > 代码库 > 键盘学习笔记

键盘学习笔记

- (void)handleKeyboardDidShow:(NSNotification *)notification

{

    NSDictionary *info = [notification userInfo];

    CGRect keyboardFrame;

    [[info objectForKey:UIKeyboardFrameEndUserInfoKey] getValue:&keyboardFrame];

    CGSize kbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey]CGRectValue].size;

//    UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, kbSize - 20, <#CGFloat width#>, <#CGFloat height#>)]

    CGFloat distanceToMove = kbSize.height;

    NSLog(@"动态键盘高度:%.1f",distanceToMove);

    

    //    if (exitButton == nil) {

    //        exitButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];

    //        CGRect exitBtFrame = CGRectMake(self.view.frame.size.width-40, self.view.frame.size.height - distanceToMove, 40.0f, 30.0f);

    //        exitButton.frame = exitBtFrame;

    //        [exitButton setImage:[UIImage imageNamed:@"DoneDown.png"] forState:UIControlStateNormal];

    //        [self.view addSubview:exitButton];

    //

    //    }

    //    exitButton.hidden=NO;

    //    [self adjustPanelsWithKeyBordHeight:distanceToMove];

    //    [exitButton addTarget:self action:@selector(CancelBackKeyboard:) forControlEvents:UIControlEventTouchDown];

}


本文出自 “深圳市联城通科技公司” 博客,请务必保留此出处http://roderickkennedy.blog.51cto.com/6758427/1577769

键盘学习笔记