我在我的应用中遇到了uiwebview的问题。键盘完全取代了网页内容,我无法将其移回原位。在webview中垂直上下弹跳时,输入字段时也会出现问题。
键盘之前
Before http://www.306radio.ca/mobile/photo.PNG
键盘后(无法向下滚动)(http://www.306radio.ca/mobile/chat) after http://www.306radio.ca/mobile/photo1.PNG
答案 0 :(得分:2)
实施 UIKeyboardDidShowNotification
和 UIKeyboardWillHideNotification
,以便您可以重新定位网络视图。
示例:强>
- (void)viewDidLoad
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWasShown:)
name:UIKeyboardDidShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
}
- (void)keyboardWasShown:(NSNotification *)notification
{
//align Web-view here
}
- (void)keyboardWillHide:(NSNotification *)notification
{
//align Web-view here
}
- (void)viewDidUnload
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}