liushuangls / memo

用于记录
1 stars 0 forks source link

cordova踩坑 #46

Open liushuangls opened 6 years ago

liushuangls commented 6 years ago

ios

禁用整个应用页面的上下拖动效果(防止拖动出现黑边)

在 config.xml 中进行如下设置:

<preference name="WebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />

解决Cordova开发的iOS的app界面被状态栏覆盖

在使用cordova6.0的过程中,编译好的APP运行在IOS7+系统上默认是与状态栏重叠的,而运行在IOS6及老版本中时是于状态栏分离的。 把文件MainViewController.m中的方法viewWillAppear进行相关修改如下。 作用是更改view的边界,使其下移20px,刚好是状态栏的高度。

- (void)viewWillAppear:(BOOL)animated  
{  
    // View defaults to full size.  If you want to customize the view's size, or its subviews (e.g. webView),  
    // you can do so here.  
    if([[[UIDevice currentDevice]systemVersion ] floatValue]>=7)  
    {  
        CGRect viewBounds=[self.webView  bounds];  
        viewBounds.origin.y=20;  
        viewBounds.size.height=viewBounds.size.height-20;  
        self.webView.frame=viewBounds;  
    }  

    [super viewWillAppear:animated];  
}