我有一个UIViewController使用self.accountViewController.modalPresentationStyle = UIModalPresentationFormSheet;,现在在iOS 8中,UITextView当它被推高时,最后一个是从键盘隐藏的.怎么避免呢?
我正在开发有一个聊天应用程序UITableView和一个UIView包含UITextField与UIButton在其中.我正在使用以下代码UIView在键盘出现时向上移动.
(void)keyboardWillShow:(NSNotification *)notification
{
NSDictionary* info = [notification userInfo];
CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
[UIView animateWithDuration:0.2f animations:^{
CGRect frame = self.inputView.frame;
UIInterfaceOrientation orientation = self.interfaceOrientation;
if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight)
frame.origin.y -= kbSize.width;
else
frame.origin.y -= kbSize.height;
self.inputView.frame = frame;
;
}];
}
Run Code Online (Sandbox Code Playgroud)
此代码在iOS 7之前正常工作,但在iOS 8 UIView中没有显示在键盘上方.
任何人都可以建议可能存在的问题,或者iOS 8中有什么变化吗?
cocoa-touch ×1
ios ×1
ios8 ×1
keyboard ×1
uikeyboard ×1
uitableview ×1
uitextfield ×1
uiview ×1