相机打开后,离子应用程序渲染不正确 [英] Ionic app rendering incorrectly after camera opened

查看:89
本文介绍了相机打开后,离子应用程序渲染不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个离子1应用程序,它使用$ cordovaCamera从用户检索照片。奇怪的是,在相机打开后(无论用户是拍照,取消,还是从库中选择一张),应用程序一旦关闭就会呈现错误。状态栏覆盖视图顶部,视图底部溢出视口。但是,如果您重新定位设备(从纵向移动到横向),它将自行修复。

I have an ionic 1 app that uses $cordovaCamera to retrieve a photo from the user. Oddly, after the camera is opened (doesn't matter whether the user takes a picture, cancels, or picks one from library) the app renders incorrectly once it's closed. The status bar overlays the top of the view, and the bottom of the view overflows off the viewport. However, if you re-orient the device (go from portrait to landscape) it will fix itself.

有没有办法强制应用程序手动重绘?

Is there any way to force the app to repaint manually?

关于错误本身的额外信息:我分别创建了一个新的离子1应用程序并完全复制了相机代码,它没有同样的问题。相同版本的离子,角度,ngCordova和相机插件。所以我认为实际的渲染问题是我的应用程序特有的。然而,经过一整天的捣乱,我无法弄清楚我的生活发生了什么。

Extra info regarding the bug itself: I created a new ionic 1 app separately and copied the camera code over exactly and it does not have the same problem. Same versions of ionic, angular, ngCordova, and the camera plugin. So I believe the actual rendering problem is specific to my app. However, after a full day of messing around I can't figure out for the life of me what's happening.

推荐答案

我们有与cordova-plugin-statusbar版本相同的问题: 2.2.1

解决方案非常简单。我们将此依赖关系降级为版本 2.2.0 ,一切都按预期工作。

We had the same issue with the cordova-plugin-statusbar version: 2.2.1
The solution was pretty simple. We downgraded this dependency to version 2.2.0 and everything worked as expected again.

要使用确切版本的cordova插件,请指定它在项目的 config.xml 中,如下例所示:

To use an exact version of a cordova plugin, specify it in the config.xml of your project as in example below:

< plugin name =cordova-plugin-statusbarspec =2.2.0/>

别忘了删除 ./ platforms ./ plugins 文件夹并运行 cordova prepare 之后降级插件版本。

Don't forget to remove ./platforms and ./plugins folders and to run cordova prepare after downgrading the plugin versions.

这篇关于相机打开后,离子应用程序渲染不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆