1
鍵盤信息詞典返回表情符號鍵盤高度的數字不正確。如果我點擊文本字段,它會使正常鍵盤動起來,但是當我點擊表情符號時,它仍認爲高度是標準鍵盤。爲什麼?有沒有辦法以編程方式獲得替代(表情符號)鍵盤高度。常數37是我投入使用的一種可怕的黑客。繪製表情符號鍵盤的高度IOS 8
- (void)keyboardWillShow:(NSNotification *)notification {
if (!IS_SHOWING_KEYBOARD) {
IS_SHOWING_KEYBOARD=YES;
NSDictionary *userInfo = [notification userInfo];
CGSize keyboardSize = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
keyboardSize = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
[self.view layoutIfNeeded];
self.commentTopLayout.constant -= keyboardSize.height;
self.commentBottomLayout.constant -= keyboardSize.height;
[UIView animateWithDuration:0.2f animations:^{
[self.view layoutIfNeeded];
}];
} else { //move him down, then up again. //clicked on emojis
NSDictionary *userInfo = [notification userInfo];
CGSize keyboardSize = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
keyboardSize = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
[self.view layoutIfNeeded];
self.commentTopLayout.constant += keyboardSize.height;
self.commentBottomLayout.constant += keyboardSize.height;
[UIView animateWithDuration:0.2f animations:^{
[self.view layoutIfNeeded];
}];
[self.view layoutIfNeeded];
self.commentTopLayout.constant -= keyboardSize.height+37;
self.commentBottomLayout.constant -= keyboardSize.height+37;
[UIView animateWithDuration:0.2f animations:^{
[self.view layoutIfNeeded];
}];
}
}
可能重複? http://stackoverflow.com/questions/29926144/how-to-get-ios-8-3-emoji-keyboard-height –
@Dejan Skledar我正在使用與他們相同的解決方案,據我所知,不起作用。 – smith938584