我是Corona Enterprise和Objective C的新手,但是我已经有了我想在没有Corona的情况下在XCode上工作的内容。现在,当我试图将它放入一个Corona项目中时,它并不能很好地工作......如何使用Corona Enterprise在iOS上本地更改窗口颜色?
我将代码缩小到了最低限度,只将窗口颜色设置为红色。发生了什么事情是窗口变成了红色,但在XCode模拟器上只有不到一秒钟的时间。在那之后,就变成黑色......再次
这里是我的AppDelegate代码:
showLoading(lua_State *L)
{
void *platformContext = CoronaLuaGetContext(L); // lua_touserdata(L, lua_upvalueindex(1));
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);
}
而且在main.lua我只叫:
window.showLoading()
我在做什么错?我只需要了解这一点就可以在窗口中显示我想要的内容。我试着用runtime.appViewController.view.backgroundColor
但屏幕仍然显示一个黑色,而不是红色...