1. <i id='m8vai'><tr id='m8vai'><dt id='m8vai'><q id='m8vai'><span id='m8vai'><b id='m8vai'><form id='m8vai'><ins id='m8vai'></ins><ul id='m8vai'></ul><sub id='m8vai'></sub></form><legend id='m8vai'></legend><bdo id='m8vai'><pre id='m8vai'><center id='m8vai'></center></pre></bdo></b><th id='m8vai'></th></span></q></dt></tr></i><div id='m8vai'><tfoot id='m8vai'></tfoot><dl id='m8vai'><fieldset id='m8vai'></fieldset></dl></div>
    <legend id='m8vai'><style id='m8vai'><dir id='m8vai'><q id='m8vai'></q></dir></style></legend>
  2. <small id='m8vai'></small><noframes id='m8vai'>

    <tfoot id='m8vai'></tfoot>

        <bdo id='m8vai'></bdo><ul id='m8vai'></ul>

      防止 UIWebView 重新定位输入字段

      时间:2023-11-09

          1. <legend id='ITSUe'><style id='ITSUe'><dir id='ITSUe'><q id='ITSUe'></q></dir></style></legend>

            <small id='ITSUe'></small><noframes id='ITSUe'>

              <bdo id='ITSUe'></bdo><ul id='ITSUe'></ul>
                <tbody id='ITSUe'></tbody>
              <tfoot id='ITSUe'></tfoot>

                <i id='ITSUe'><tr id='ITSUe'><dt id='ITSUe'><q id='ITSUe'><span id='ITSUe'><b id='ITSUe'><form id='ITSUe'><ins id='ITSUe'></ins><ul id='ITSUe'></ul><sub id='ITSUe'></sub></form><legend id='ITSUe'></legend><bdo id='ITSUe'><pre id='ITSUe'><center id='ITSUe'></center></pre></bdo></b><th id='ITSUe'></th></span></q></dt></tr></i><div id='ITSUe'><tfoot id='ITSUe'></tfoot><dl id='ITSUe'><fieldset id='ITSUe'></fieldset></dl></div>

              • 本文介绍了防止 UIWebView 重新定位输入字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个 iPad 应用程序,我在其中将输入表单显示为 UIPopoverController 中的 UIWebView.我的弹出框控制器的大小使得当键盘出现时不必调整它的大小.

                I have an iPad application in which I am displaying an input form as a UIWebView in a UIPopoverController. My popover controller is sized such that it does not have to be resized when the keyboard appears.

                当我点击 UIWebView 中的输入字段时,当键盘出现时,Web 视图会被进一步向上推.它被推到文本字段位于框架顶部的位置.(这是您在移动 Safari 中使用表单时看到的标准行为).

                When I tap in an input field in the UIWebView, the web view is pushed further up when the keyboard appears. It is pushed up to the point that the text field is at the top of the frame. (This is the standard behavior you see when using forms in mobile safari).

                在键盘启动之前,webview 根本不滚动,但一旦滚动,(如第二张图片所示)我可以将 webview 向下滚动到正确的位置.

                The webview does not scroll at all before the keyboard is up, but once it is, (as seen in the second image) I can scroll the webview back down to the correct position.

                因为我的 webview 的大小已经正确,所以我不想要这种行为.有人对如何防止这种情况有任何建议吗?(目前不可以在这里不使用网络视图)

                Because my webview is already sized correctly, I do not want this behavior. Does anyone have any suggestions on how to prevent this? (Not using a web view here is currently not an option)

                谢谢!

                推荐答案

                1. viewDidLoad

                [[NSNotificationCenter defaultCenter] addObserver:self 
                    selector:@selector(keyboardWillShow:) 
                    name:UIKeyboardWillShowNotification object:nil];
                

              • 实现keyboardWillShow: 并重新调整WebviewScroller 方法

              • Implement keyboardWillShow: and readjustWebviewScroller methods

                - (void)keyboardWillShow:(NSNotification *)aNotification {
                    [self performSelector:@selector(readjustWebviewScroller) withObject:nil afterDelay:0];
                }
                
                
                - (void)readjustWebviewScroller {
                    _webView.scrollView.bounds = _webView.bounds;
                }
                

              • 这对我有用.

                这篇关于防止 UIWebView 重新定位输入字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:在 UIWebView 中调用 loadRequest 时出现 GeneralBlock-56 内存泄漏 下一篇:如何立即停止 UIWebView 加载

                相关文章

                  • <bdo id='lUu4U'></bdo><ul id='lUu4U'></ul>
                1. <tfoot id='lUu4U'></tfoot>

                  <small id='lUu4U'></small><noframes id='lUu4U'>

                  <i id='lUu4U'><tr id='lUu4U'><dt id='lUu4U'><q id='lUu4U'><span id='lUu4U'><b id='lUu4U'><form id='lUu4U'><ins id='lUu4U'></ins><ul id='lUu4U'></ul><sub id='lUu4U'></sub></form><legend id='lUu4U'></legend><bdo id='lUu4U'><pre id='lUu4U'><center id='lUu4U'></center></pre></bdo></b><th id='lUu4U'></th></span></q></dt></tr></i><div id='lUu4U'><tfoot id='lUu4U'></tfoot><dl id='lUu4U'><fieldset id='lUu4U'></fieldset></dl></div>

                  <legend id='lUu4U'><style id='lUu4U'><dir id='lUu4U'><q id='lUu4U'></q></dir></style></legend>