Вопрос

I am building an universal iOS app with JS/HTML5/CSS3 and Phonegap. I am targeting the iPad, iPhone (old) and iPhone5, both orientations (portrait/landscape each).

Since I can't accomplish just ONE markup for all versions, I am wondering how I deal with that. I want to have one markup for one device with both orientations, so I will have three markups.

Is the app able to detect which markup it needs depending on the device it runs? And if so, how? :)

Thanks!

Это было полезно?

Решение

Yes you can. You just have to make a device.model. This return the also the version. For exemple you can have iPad1.1 (for the first one)

function onDeviceReady() {

if (device.model == "iPad1,1") {
    //DO SOMETHING
}
else if (device.model == "iPad2,3") {
    //DO SOMETHING ELSE
}


}

Here is the phonegap page

For exemple, I use this to active or not the possibility to take picture from my device. if it's iPad1 I disable the functionnality.

Hope it helps ;)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top