鍵盤學習筆記

- (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];

}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章