在使用PhoneGap制作App的时候,iOS作为承载App页面的容器的Webview,在手指向下或者向上滑动屏幕时,除了页面本身的滚动外,还经常会看到整体页面底部和屏幕底部被拖动出黑屏
为了防止这一滑动,可以通过修改修改项目中的MainViewController.m,重新设置WebView来实现
- (void)webViewDidFinishLoad:(UIWebView*)theWebView
{
// Black base color for background matches the native apps
theWebView.backgroundColor = [UIColorblackColor];
[(UIScrollView *)[[theWebView subviews] objectAtIndex:0] setBounces:NO];
return [superwebViewDidFinishLoad:theWebView];
}
本文介绍如何通过修改MainViewController.m文件中的代码来解决iOS设备上使用PhoneGap制作的应用中Webview出现的额外弹跳问题。具体操作是设置WebView加载完成后的背景颜色,并禁止UIScrollView的反弹效果。
513

被折叠的 条评论
为什么被折叠?



