Obtener las dimensiones de la pantalla (screen.size)
Declaración
ancho_de_pantalla, alto_de_pantalla = screen.size()
Valores devueltos
- ancho de pantalla, tipo entero
- alto de pantalla, tipo entero
Descripción
Los valores devueltos por esta función no dependen del estado vertical u horizontal del escritorio o la aplicación del dispositivo, ni del modo ampliado
Esta función puede usarse en XUI
Ejemplo
-- Determina el tipo de dispositivo según la resolución
width, height = screen.size()
if width == 640 and height == 1136 then
-- iPhone 5, 5S, iPod touch 5
elseif width == 640 and height == 960 then
-- iPhone 4, 4S, iPod touch 4
elseif width == 750 and height == 1334 then
-- iPhone 6, 6S, 7, 8
elseif width == 1242 and height == 2208 then
-- iPhone 6+, 6S+, 7+, 8+
elseif width == 768 and height == 1024 then
-- iPad 1, 2, mini 1
elseif width == 1536 and height == 2048 then
-- iPad 3, 4, 5, mini 2
elseif width == 320 and height == 480 then
-- iPhone 3GS / iPhone 4 (solo se incluye para completar la lista; XXTouch no admite dispositivos tan antiguos)
end