所以我有一个 ios 应用程序,在 ios6/iPhone5 之前。它运作良好。我目前正在尝试为 iPhone5 和 ios6 修复它。进展顺利,我已经解决了 99% 的 ios6 错误,并且似乎可以正常工作。然而,iPhone 5 是喜怒无常的。
我正在使用 PhoneGap 1.8.1。有一次,我用相机拍摄了一张照片,使用了这个功能:
function capturePhoto() {
networkState = navigator.network.connection.type;
if (networkState == Connection.NONE)
{
alert('You must be connected to the internet to use this feature!');
}else{
var options = {
quality: 100,
correctOrientation: false,
destinationType : navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.CAMERA,
encodingType: navigator.camera.EncodingType.JPEG,
}
navigator.camera.getPicture(onPhotoDataSuccess, onFail, options);
}
}
然后,我将图像显示为 HTML 画布上的背景。使用 kineticJS 但出于这个问题的目的,我认为您需要知道的只是:
var canvaswidth = window.innerWidth;
var canvasheight = window.innerHeight;
var darthVaderImg = new Kinetic.Image({
x: 0,
y: 0,
image: images.darthVader,
width: canvaswidth,
height: canvasheight,
name: "image"
});
这在 iphone 4s ios 6 上运行正常,在 android 上运行正常……但在 iPhone 5 上却不行。图片是正确的方向,但它在顶部被压扁,我尝试将其硬编码为 iPhone 5 的屏幕尺寸......我相信是 640x1136?
仍然没有运气,例如,如果我夸大并将图像高度设置为 2000,它确实会覆盖屏幕,但会放大。我对正在发生的事情有点迷失......任何人都有类似的问题,或任何想法?