以phoneGap作为承载容器是ios会上下滑动

在使用PhoneGap制作App的时候,iOS作为承载App页面的容器的Webview,在手指向下或者向上滑动屏幕时,除了页面本身的滚动外,还经常会看到整体页面底部和屏幕底部被拖动出黑屏

为了防止这一滑动,可以通过修改修改项目中的MainViewController.m,重新设置WebView来实现

- (void)webViewDidFinishLoad:(UIWebView*)theWebView
{
    // Black base color for background matches the native apps
//    theWebView.backgroundColor = [UIColor blackColor];
//
//    return [super webViewDidFinishLoad:theWebView];
    // Black base color for background matches the native apps
  
    theWebView.backgroundColor = [UIColor blackColor];
   
    [(UIScrollView *)[[theWebView subviews] objectAtIndex:0] setBounces:NO];

    return [super webViewDidFinishLoad:theWebView];

}
原文博客:

http://blog.smdcn.net/article/1404.html


发布了29 篇原创文章 · 获赞 11 · 访问量 4万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章