h5打包app后的问题
1、苹果页面超出隐藏造成卡顿
解决方式 overflow:auto; -webkit-overflow-scrolling: touch; /* ios5+ */
2、h5打包后在ios下内容与状态栏重叠问题:
1:知道设备的类型:
var u = navigator.userAgent, app = navigator.appVersion; var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器 var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端2:当设备是ios时,添加一个给body加一个类名:
if(isiOS){ $("body").addClass("uh_ios7"); }css文件下加样式:
.uh_ios7 .uh,.uh_ios7{ padding: 2em 0 0; }- (void)viewWillAppear:(BOOL)animated
{
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];
}
-(void)viewWillDisappear:(BOOL)animated
{
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 viewWillDisappear:animated];
}
浙公网安备 33010602011771号