-1

我的应用程序中的 uiwebview 有问题。键盘完全取代了网页内容,我无法将其移回原位。在输入字段时,webview 会垂直上下弹跳也存在问题。

键盘前

之前 http://www.306radio.ca/mobile/photo.PNG

键盘后(不能向下滚动)(http://www.306radio.ca/mobile/chat后 http://www.306radio.ca/mobile/photo1.PNG

4

1 回答 1

2

实现UIKeyboardDidShowNotificationUIKeyboardWillHideNotification你可以做 Web-view reposition 。

例子:

- (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];
}
于 2013-03-13T01:33:10.350 回答