Simple example using appWindow to change background Color on iOS

Hi there,

First, I would like to say that I’m new on iOS and Objective C and so, I’m trying to implement a separate project I made natively for iOS inside a Corona Project.

Right now, I just want to change the background color of the app window as a test for my code but, I can’t get it to work… It changes for less then a second to Red but then it becomes Black again…

On AppDelegate.mm I have this:

showLoading( lua\_State \*L ) { void \*platformContext = CoronaLuaGetContext( L ); id\<CoronaRuntime\> runtime = (id\<CoronaRuntime\>)platformContext; runtime.appWindow.backgroundColor = [UIColor redColor]; // Return 0 since this Lua function does not return any values. return 0; } - (void)willLoadMain:(id\<CoronaRuntime\>)runtime { lua\_State \*L = runtime.L; const luaL\_Reg kFunctions[] = { "showLoading", showLoading, NULL, NULL }; luaL\_register( L, "window", kFunctions ); lua\_pop( L, 1 ); }

And on main.lua I’m calling only this:

window.showLoading()

So, what am I doing wrong? Why does it only shows up for less then a second?

I tried “runtime.appViewController.view.backgroundColor” instead but it doesn’t work too…

I’m trying to run this using XCode Simulator.

Ok, I found what was wrong. I opened a question before on stackoverflow and so, here’s the link to the answer:

http://stackoverflow.com/questions/20223446/how-to-change-window-color-natively-on-ios-using-corona-enterprise/20225030#20225030

Ok, I found what was wrong. I opened a question before on stackoverflow and so, here’s the link to the answer:

http://stackoverflow.com/questions/20223446/how-to-change-window-color-natively-on-ios-using-corona-enterprise/20225030#20225030