Yes, groups are the answer. The solution is to create two groups, one for your ui and one for the stuff you want below the ui, then insert both groups into a third, “parent” group, making sure to insert the ui group LAST. That will keep the ui objects on top no matter what you do inside either child group.
for example:
--define groups
local bottomDisplayGroup = display.newGroup()
local uiDisplayGroup = display.newGroup()
local parentGroup = display.newGroup()
--then insert display groups into the parent group:
parentGroup:insert(bottomDisplayGroup)
parentGroup:insert(uiDisplayGroup)--this is last so it will be on TOP
--now you can add display objects to the bottomGroup. i.e.-
box1 = display.newRect(0,0,10,10)
bottomDisplayGroup:insert(box1)
--after you create new buttons using ui.lua insert them into the ui group:
uiDisplayGroup:insert(button1)
You can safely insert objects into either group and since you already defined the order of the groups anything you put inside the ui group will be on top of everything you put in the bottom group. You can even have groups inside groups inside groups etc. for even finer control of what renders on top of what. Even WITHIN a group, if you want something to render on top of everything else in its group, just re-insert it into its own group again.
There is nothing that special about the objects ui.lua generates. They are regular Corona display objects and can be inserted into a group like any other display object. [import]uid: 9422 topic_id: 12970 reply_id: 47588[/import]