Images not fitting on the screen

Im trying to optimize my app for the iPhone 5 but when I build the app the images are huge and don’t fit on the screen.  How do you fix this? This is what I have in the config.lua:

if string.sub(system.getInfo(“model”),1,4) == “iPad” then

    application = 

    {

        content =

        {

            width = 360,

            height = 480,

            scale = “letterBox”,

            fps = 60,

            xAlign = “center”,

            yAlign = “center”,

            imageSuffix = 

            {

                ["@2x"] = 1.5,

                ["@4x"] = 3.0,

            },

        },

        notification = 

        {

            iphone = {

                types = {

                    “badge”, “sound”, “alert”

                }

            }

        }

    }

elseif string.sub(system.getInfo(“model”),1,2) == “iP” and display.pixelHeight > 960 then

    application = 

    {

        content =

        {

            width = 320,

            height = 568,

            scale = “letterBox”,

            xAlign = “center”,

            yAlign = “center”,

            imageSuffix = 

            {

                ["@2x"] = 1.5,

                ["@4x"] = 3.0,

            },

        },

        notification = 

        {

            iphone = {

                types = {

                    “badge”, “sound”, “alert”

                }

            }

        }

    }

elseif string.sub(system.getInfo(“model”),1,2) == “iP” then

    application = 

    {

        content =

        {

            width = 320,

            height = 480,

            scale = “letterBox”,

            xAlign = “center”,

            yAlign = “center”,

            imageSuffix = 

            {

                ["@2x"] = 1.5,

                ["@4x"] = 3.0,

            },

        },

        notification = 

        {

            iphone = {

                types = {

                    “badge”, “sound”, “alert”

                }

            }

        }

    }

elseif display.pixelHeight / display.pixelWidth > 1.72 then

    application = 

    {

        content =

        {

            width = 320,

            height = 570,

            scale = “letterBox”,

            xAlign = “center”,

            yAlign = “center”,

            imageSuffix = 

            {

                ["@2x"] = 1.5,

                ["@4x"] = 3.0,

            },

        },

    }

else

    application = 

    {

        content =

        {

            width = 320,

            height = 512,

            scale = “letterBox”,

            xAlign = “center”,

            yAlign = “center”,

            imageSuffix = 

            {

                ["@2x"] = 1.5,

                ["@4x"] = 3.0,

            },

        },

        notification = 

        {

            iphone = {

                types = {

                    “badge”, “sound”, “alert”

                }

            }

        }

    }

end

Do you have the required Default-568h@2x.png file (case sensitive, 640x1136) file in the folder with your main.lua?

What sizes are your files?

What I have in my main.lua is as follows:

– Hide the status bar

display.setStatusBar( display.HiddenStatusBar )

_G.platform = system.getInfo( “platformName” )

_G.iAdsAppID = “appID”

_G.adMobAppID = “ca-app-pub-appID”

– set up ads

local ads = require “ads”

local adRelated = {}

adRelated.seconds = 0

adRelated.delay = 30

adRelated.hidden = true

if _G.platform == “iPhone OS” then

    – try to show iAds first, AdMob as backup

    local function adListener2( event )

        local msg = event.response

    end

    local function adListener( event )

        local msg = event.response

        if event.isError then

            ads.init( “admob”, _G.adMobAppID, adListener2 )

        else

        end

    end

    ads.init( “iads”, _G.iAdsAppID, adListener )

else

    – show AdMob first, no backup ad service yet

    local function adListener( event )

        local msg = event.response

        end

    ads.init( “admob”, _G.adMobAppID, adListener )

end

local adY = display.contentHeight - display.screenOriginY

ads.show( “banner”, { x = 0, y = adY} )

local storyboard = require “storyboard”

storyboard.gotoScene( “start” )

That code doesn’t show any image loading and it doesn’t answer the question about what the dimensions are on the images you are trying to load.

We need more info to help you.

Rob

You need to see something like this?:

    local screenGroup = self.view

    local background = display.newImage(“bg.png”)

    screenGroup:insert(background)

    bg = display.newImageRect(‘bg.png’,900,1425)

    bg.anchorX = 0

    bg.anchorY = 1

    bg.x = 0

    bg.y = display.contentHeight

    bg.speed = 4

    screenGroup:insert(bg)

Oh my, I just noticed I had the wrong numbers typed in. 900 and 1425 is what I forgot to change!

Do you have the required Default-568h@2x.png file (case sensitive, 640x1136) file in the folder with your main.lua?

What sizes are your files?

What I have in my main.lua is as follows:

– Hide the status bar

display.setStatusBar( display.HiddenStatusBar )

_G.platform = system.getInfo( “platformName” )

_G.iAdsAppID = “appID”

_G.adMobAppID = “ca-app-pub-appID”

– set up ads

local ads = require “ads”

local adRelated = {}

adRelated.seconds = 0

adRelated.delay = 30

adRelated.hidden = true

if _G.platform == “iPhone OS” then

    – try to show iAds first, AdMob as backup

    local function adListener2( event )

        local msg = event.response

    end

    local function adListener( event )

        local msg = event.response

        if event.isError then

            ads.init( “admob”, _G.adMobAppID, adListener2 )

        else

        end

    end

    ads.init( “iads”, _G.iAdsAppID, adListener )

else

    – show AdMob first, no backup ad service yet

    local function adListener( event )

        local msg = event.response

        end

    ads.init( “admob”, _G.adMobAppID, adListener )

end

local adY = display.contentHeight - display.screenOriginY

ads.show( “banner”, { x = 0, y = adY} )

local storyboard = require “storyboard”

storyboard.gotoScene( “start” )

That code doesn’t show any image loading and it doesn’t answer the question about what the dimensions are on the images you are trying to load.

We need more info to help you.

Rob

You need to see something like this?:

    local screenGroup = self.view

    local background = display.newImage(“bg.png”)

    screenGroup:insert(background)

    bg = display.newImageRect(‘bg.png’,900,1425)

    bg.anchorX = 0

    bg.anchorY = 1

    bg.x = 0

    bg.y = display.contentHeight

    bg.speed = 4

    screenGroup:insert(bg)

Oh my, I just noticed I had the wrong numbers typed in. 900 and 1425 is what I forgot to change!