Use PhoneGap in iOS to prevent WebView from being dragged up or down
Source: Internet
Author: User
<span id="Label3"></p><p><p>When you use PhoneGap to make an app, iOS is the webview of the container that hosts the app page, and when you swipe down or up the screen, you'll often see the bottom of the page and the bottom of the screen with a black screen in addition to the scrolling of the page itself.</p></p><p><p>To prevent this slippage, you can modify the MAINVIEWCONTROLLER.M in the project to reset the WebView to achieve</p></p>View sourceprint? <table> <tbody> <tr> <td class="number"><code>1</code></td> <td class="content"><code class="plain">- (</code><code class="keyword bold">void</code><code class="plain">)webViewDidFinishLoad:(UIWebView*)theWebView</code></td> </tr> </tbody> </table> <table> <tbody> <tr> <td class="number"><code>2</code></td> <td class="content"><code class="plain">{</code></td> </tr> </tbody> </table> <table> <tbody> <tr> <td class="number"><code>3</code></td> <td class="content"><code class="spaces"> </code><code class="comments">// Black base color for background matches the native apps</code></td> </tr> </tbody> </table> <table> <tbody> <tr> <td class="number"><code>4</code></td> <td class="content"><code class="spaces"> </code><code class="plain">theWebView.backgroundColor = [UIColorblackColor];</code></td> </tr> </tbody> </table> <table> <tbody> <tr> <td class="number"><code>5</code></td> <td class="content"><code class="spaces"> </code></td> </tr> </tbody> </table> <table> <tbody> <tr> <td class="number"><code>6</code></td> <td class="content"><code class="spaces"> </code><code class="plain">[(UIScrollView *)[[theWebView subviews] objectAtIndex:0] setBounces:NO];</code></td> </tr> </tbody> </table> <table> <tbody> <tr> <td class="number"><code>7</code></td> <td class="content"></td> </tr> </tbody> </table> <table> <tbody> <tr> <td class="number"><code>8</code></td> <td class="content"><code class="spaces"> </code><code class="keyword bold">return</code><code class="plain">[superwebViewDidFinishLoad:theWebView];</code></td> </tr> </tbody> </table> <table> <tbody> <tr> <td class="number"><code>9</code></td> <td class="content"><code class="plain">}</code></td> </tr> </tbody> </table><p><p>Use PhoneGap in iOS to prevent WebView from being dragged up or down</p></p></span>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.