Why does the status bar show after the default.png is shown!?!?

I have this as the FIRST line of my main.lua:

display.setStatusBar(display.HiddenStatusBar)

So could someone please explain why this happens:

When I click the app icon the status bar disappears and the default.png is displayed in that zoom in style.

THEN the status bar is shown, then the initial ‘splash’ screen is shown (full screen with the status bar).

I thought that having the display.setStatusBar(display.HiddenStatusBar) as the first line of the main.lua would prevent the status bar from being displayed once the app starts!?!

Please help if you can…ta :slight_smile:

This is my config.lua

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

    application = 

    {

        content =

        {

            fps = 60,

            width = 360,

            height = 480,

            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” and display.pixelHeight > 960 then

    application = 

    {

        content =

        {

            fps = 60,

            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 =

        {

            fps = 60,

            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 =

        {

            fps = 60,

            width = 320,

            height = 570,

            scale = “letterBox”,

            xAlign = “center”,

            yAlign = “center”,

            imageSuffix = 

            {

                ["@2x"] = 1.5,

                ["@4x"] = 3.0,

            },

        },

    }

else

    application = 

    {

        content =

        {

        fps = 60,

            width = 320,

            height = 512,

            scale = “letterBox”,

            xAlign = “center”,

            yAlign = “center”,

            imageSuffix = 

            {

                ["@2x"] = 1.5,

                ["@4x"] = 3.0,

            },

        },

        notification = 

        {

            iphone = {

                types = {

                    “badge”, “sound”, “alert”

                }

            }

        }

    }

end

This is my build.settings

settings = 

{

iphone =

        {

                    

                plist=

                {

UIStatusBarHidden = true,

                                                UIApplicationExitsOnSuspend = true,                                 UIPrerenderedIcon = true,

                        CFBundleIconFile = “Icon.png”,

                              CFBundleIconFiles = {

                            “Icon.png” , 

                            “Icon@2x.png” , 

                            “Icon-72.png” , 

                            “Icon-Small-50.png” , 

                            “Icon-Small.png” , 

                            “Icon-Small@2x.png”

                        },

                },

        },

    orientation = 

    {

        default = “portrait”,

        supported = 

        {

        “portrait”,

        },

                    

    },

        

        content =

    {

        fps = 60

    },

    

}

    

Are you building for iOS or Android? Or is this happening in the simulator?

Thank you for helping me. It’s iOS (hence me posting in the iOS forum :wink: ) It happens on the device (iPhone 4) and I’m using the very latest build of corona. It’s hard to see exactly what happens on the simulator as its doing its initial screen resizing UI stuff that is quite frankly annoying

Sorry.  I don’t always pay attention to what forum things are in.  I read all the posts since my last login and it groups things together, not in individual forums…

I just checked several of my apps and they don’t show the status bar at any point after I tap the icon.

The only thing I can think of is there is an error in your build.settings, but I don’t see anything obvious in what you posted.  In one of my games, I call the setStatusBar() function pretty deep in the code and I never see it.

Can you tell me more about it’s initial screen resizing UI stuff?

I’m using director 1.4, the main.lua is as follows:

display.setStatusBar(display.HiddenStatusBar)

local options = require(“options”)

local tools = require(“tools”)

tools.getEnviron()

– Import director class

local director = require(“director”)

– Create a main group

local mainGroup = display.newGroup()

sndButton = tools.newEventSoundXP{ ios=“button_caf.caf”, android=“button_mp3.mp3” }

sndSlider = tools.newEventSoundXP{ ios=“slider_caf.caf”, android=“slider_mp3.mp3” }

local function main()

    mainGroup:insert(director.directorView)

    director:changeScene(“splash”, “crossfade”)

    

    return true

end

main()


the tools.lua is :

module(…, package.seeall)

local isSim = null

–[[

SYNTAX:

writeToFile( data, filename [, baseDirectory] )

USAGE:

local saveData = “example data to save”

writeToFile( saveData, “myFile.txt”, system.TemporaryDirectory )

–]]

function writeToFile( data, filename, baseDirectory )

    local baseDirectory = baseDirectory or system.DocumentsDirectory

    local path = system.pathForFile( filename, baseDirectory )

    local file = io.open( path, “w” )

    file:write( data )

    io.close( file )

end

–[[

SYNTAX:

readFromFile( filename [, baseDirectory] )

USAGE:

local loadedData = readFromFile( “myFile.txt”, system.DocumentsDirectory )

–]]

function readFromFile( filename, baseDirectory )

    local baseDirectory = baseDirectory or system.ResourceDirectory

    local path = system.pathForFile( filename, baseDirectory )

    local file = io.open( path, “r” )

    local data

    

    print(filename)

    print(baseDirectory)

    print(path)

    if file then

        print(“found file”)

        data = file:read( “*n” )

        print(data)

    else

        print(“creating file”)

        file = io.open( path, “w” )

        file:write(0)

    end

    

    io.close( file )

    

  –  print("read file - returning : " … data)

    return data

end

– A function for cross-platform event sounds

function newEventSoundXP( params )

    local isAndroid = “Android” == system.getInfo(“platformName”)

    if isAndroid and params.android then

        soundID = audio.loadSound( params.android ) – return sound file for Android

    elseif params.ios then

        soundID = audio.loadSound( params.ios ) – return sound file for iOS/MacOS

    end

    

    return soundID

end

– A function for cross-platform fonts

function newFontXP( params )

    local isAndroid = “Android” == system.getInfo(“platformName”)

    if isAndroid and params.android then

        font = params.android – return font for Android

    elseif params.ios then

        font = params.ios – return font for iOS/MacOS

    else

        font = native.systemFont – default font (Helvetica on iOS, Android Sans on Android)

    end

    

    return font

end

function getEnviron()

    if(system.getInfo( “environment” ) == “simulator”) then    

        isSim = true

    else

        isSim = false

    end

end

function dprint(str)

    if isSim then

        print(str)

    end

    

end


and options.lua is :

module(…, package.seeall)

local opt_sounds = “off”

local opt_vibrate = “off”

local opt_numballs = “2”

local opt_difficulty = “easy”

local opt_crossbar = “on”

local opt_savescore = “on”

function options:setOption(option, value)

    if (option == “sounds”) then

        opt_sounds = value

    elseif (option == “vibrate”) then

        opt_vibrate = value

    elseif (option == “numballs”) then

        opt_numballs = value

    elseif (option == “difficulty”) then

        opt_difficulty = value

    elseif (option == “crossbar”) then

        opt_crossbar = value

    elseif (option == “savescore”) then

        opt_savescore = value

    end

–    print("options.lua, options:setOption, option = “…option…” value = "…value)

end

function options:getOption(option)

–    print("options.lua, options:getOption, option = "…option)

   if (option == “sounds”) then

       return opt_sounds

   elseif (option == “vibrate”) then

       return opt_vibrate

   elseif (option == “numballs”) then

       return opt_numballs

   elseif (option == “difficulty”) then

       return opt_difficulty

     elseif (option == “crossbar”) then

       return opt_crossbar

   elseif (option == “savescore”) then

       return opt_savescore

   end

end

I fixed it.   But sadly I’m not too sure how!!!   I think it was a combination of using the ‘ultimate lua config’ but not having the correct sized default.png - thanks for the assistance though!

Are you building for iOS or Android? Or is this happening in the simulator?

Thank you for helping me. It’s iOS (hence me posting in the iOS forum :wink: ) It happens on the device (iPhone 4) and I’m using the very latest build of corona. It’s hard to see exactly what happens on the simulator as its doing its initial screen resizing UI stuff that is quite frankly annoying

Sorry.  I don’t always pay attention to what forum things are in.  I read all the posts since my last login and it groups things together, not in individual forums…

I just checked several of my apps and they don’t show the status bar at any point after I tap the icon.

The only thing I can think of is there is an error in your build.settings, but I don’t see anything obvious in what you posted.  In one of my games, I call the setStatusBar() function pretty deep in the code and I never see it.

Can you tell me more about it’s initial screen resizing UI stuff?

I’m using director 1.4, the main.lua is as follows:

display.setStatusBar(display.HiddenStatusBar)

local options = require(“options”)

local tools = require(“tools”)

tools.getEnviron()

– Import director class

local director = require(“director”)

– Create a main group

local mainGroup = display.newGroup()

sndButton = tools.newEventSoundXP{ ios=“button_caf.caf”, android=“button_mp3.mp3” }

sndSlider = tools.newEventSoundXP{ ios=“slider_caf.caf”, android=“slider_mp3.mp3” }

local function main()

    mainGroup:insert(director.directorView)

    director:changeScene(“splash”, “crossfade”)

    

    return true

end

main()


the tools.lua is :

module(…, package.seeall)

local isSim = null

–[[

SYNTAX:

writeToFile( data, filename [, baseDirectory] )

USAGE:

local saveData = “example data to save”

writeToFile( saveData, “myFile.txt”, system.TemporaryDirectory )

–]]

function writeToFile( data, filename, baseDirectory )

    local baseDirectory = baseDirectory or system.DocumentsDirectory

    local path = system.pathForFile( filename, baseDirectory )

    local file = io.open( path, “w” )

    file:write( data )

    io.close( file )

end

–[[

SYNTAX:

readFromFile( filename [, baseDirectory] )

USAGE:

local loadedData = readFromFile( “myFile.txt”, system.DocumentsDirectory )

–]]

function readFromFile( filename, baseDirectory )

    local baseDirectory = baseDirectory or system.ResourceDirectory

    local path = system.pathForFile( filename, baseDirectory )

    local file = io.open( path, “r” )

    local data

    

    print(filename)

    print(baseDirectory)

    print(path)

    if file then

        print(“found file”)

        data = file:read( “*n” )

        print(data)

    else

        print(“creating file”)

        file = io.open( path, “w” )

        file:write(0)

    end

    

    io.close( file )

    

  –  print("read file - returning : " … data)

    return data

end

– A function for cross-platform event sounds

function newEventSoundXP( params )

    local isAndroid = “Android” == system.getInfo(“platformName”)

    if isAndroid and params.android then

        soundID = audio.loadSound( params.android ) – return sound file for Android

    elseif params.ios then

        soundID = audio.loadSound( params.ios ) – return sound file for iOS/MacOS

    end

    

    return soundID

end

– A function for cross-platform fonts

function newFontXP( params )

    local isAndroid = “Android” == system.getInfo(“platformName”)

    if isAndroid and params.android then

        font = params.android – return font for Android

    elseif params.ios then

        font = params.ios – return font for iOS/MacOS

    else

        font = native.systemFont – default font (Helvetica on iOS, Android Sans on Android)

    end

    

    return font

end

function getEnviron()

    if(system.getInfo( “environment” ) == “simulator”) then    

        isSim = true

    else

        isSim = false

    end

end

function dprint(str)

    if isSim then

        print(str)

    end

    

end


and options.lua is :

module(…, package.seeall)

local opt_sounds = “off”

local opt_vibrate = “off”

local opt_numballs = “2”

local opt_difficulty = “easy”

local opt_crossbar = “on”

local opt_savescore = “on”

function options:setOption(option, value)

    if (option == “sounds”) then

        opt_sounds = value

    elseif (option == “vibrate”) then

        opt_vibrate = value

    elseif (option == “numballs”) then

        opt_numballs = value

    elseif (option == “difficulty”) then

        opt_difficulty = value

    elseif (option == “crossbar”) then

        opt_crossbar = value

    elseif (option == “savescore”) then

        opt_savescore = value

    end

–    print("options.lua, options:setOption, option = “…option…” value = "…value)

end

function options:getOption(option)

–    print("options.lua, options:getOption, option = "…option)

   if (option == “sounds”) then

       return opt_sounds

   elseif (option == “vibrate”) then

       return opt_vibrate

   elseif (option == “numballs”) then

       return opt_numballs

   elseif (option == “difficulty”) then

       return opt_difficulty

     elseif (option == “crossbar”) then

       return opt_crossbar

   elseif (option == “savescore”) then

       return opt_savescore

   end

end

I fixed it.   But sadly I’m not too sure how!!!   I think it was a combination of using the ‘ultimate lua config’ but not having the correct sized default.png - thanks for the assistance though!