如果连接了硬件键盘(否则它们连接到屏幕键盘的顶部),则输入附件视图将显示在屏幕底部。
将输入视图的附件视图设置UIView
为 size为空CGRectZero
。您将收到两种情况的显示/隐藏通知,并能够从通知的用户信息字典中的指标确定可用的屏幕尺寸。
UIView *inputAccessoryView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
inputAccessoryView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
textView.inputAccessoryView = inputAccessoryView;
…
- (void)keyboardWillShow:(NSNotification*)aNotification {
NSLog(@"%@", [aNotification userInfo]);
}
记录的指标 - 请注意帧在UIKeyboardFrameEndUserInfoKey
屏幕外
// (NSDictionary *) {
// UIKeyboardAnimationCurveUserInfoKey = 0;
// UIKeyboardAnimationDurationUserInfoKey = "0.25";
// UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {768, 264}}";
// UIKeyboardCenterBeginUserInfoKey = "NSPoint: {384, 891}";
// UIKeyboardCenterEndUserInfoKey = "NSPoint: {384, 1155}";
// UIKeyboardFrameBeginUserInfoKey = "NSRect: {{0, 758}, {768, 264}}";
// UIKeyboardFrameChangedByUserInteraction = 0;
// UIKeyboardFrameEndUserInfoKey = "NSRect: {{0, 1022}, {768, 264}}";
// }
更新 - 与user721239在相关问题中的回答非常相似。