Display groups within storyboard

I’m struggling to find any documentation about this, but surely it’s a major problem.

I always group my elements together nicely in display groups. An example might be a login form. I would create a group called ‘form’ and add the labels and text fields to that group. That way, if I want to remove the form or hide it then I can just hide the form group.

When doing this with Storyboard I’ve had nothing but trouble. Scene1 has 3 groups (‘form’, ‘loading’ and ‘restart’) and the main group (self.view). I have added various elements to the 3 groups and then added those to the main group (self.view). There are also other generic elements added directly into the main group (self.view).

Why is it that when I change scenes all elements are removed that are placed directly into the main group, but NOT the child groups. The next scene has all 3 groups still on the screen?!

Please point me towards some documentation about maintaining child groups within storyboard, as this baffling, and very frustrating.

Thanks [import]uid: 61422 topic_id: 25505 reply_id: 325505[/import]

I guess it depends on what you’re doing? I’ll just blab on and you can tell more when you have a chance.

Everything you add to self.view goes with self.view at the scene is processed. (So any child of self.view, or child of child of child of self.view goes with it when you load a new scene.)

In terms of addressing, unless you pre-declare the childgroup, the only way you can refer to it is as a child of the existing group.

[code]local scene = self.view – scene group
local bigGroup = display.newGroup()
local smallGroup = display.newGroup()
local stuff = display.newRect(0,0,32,32)

smallGroup:insert(stuff)
bigGroup:insert(smallGroup)[/code]

If I do that…none of the groups will disappear when you switch scenes, simply because at no point are the groups connected to ‘scene’.

The other thing to keep in mind is that stuff can only belong to one group at a time.

local rect = display.newRect(0,0,32,32) smallGroup:insert(rect) scene:insert(rect) -- it's no longer part of smallGroup!

If stuff is connected to scene but not moving with it, it could be a bug version? Which version are you using? [import]uid: 41884 topic_id: 25505 reply_id: 103082[/import]

I use groups all the time with Storyboard and don’t experience this problem.

You do have to do:
group:insert(myGroup)
where group = self.view

[import]uid: 19626 topic_id: 25505 reply_id: 103093[/import]

Weird, I rebooted my mac and it fixed itself. Wonder if it was a problem with the simulator or something? [import]uid: 61422 topic_id: 25505 reply_id: 103953[/import]