I am trying to add a variable amount of MenuItem objects to a Menu object on runtime. When my game starts I don't really know if my menu is having 2 or for example 5 items.
for (MyItem* item in myItemCollection)
{
MenuItemImage* menuItem = [MenuItemImage itemFromNormalImage:@"MenuItem.png" selectedImage:@"MenuItemSelected.png" target:self selector:@selector(options:)];
}
How do I now add the MenuItems to a Menu object. By using addChild I get an exception and I can't really find a solution online.
Also, a side-question: When I can add my MenuItem's this way. How can I get my MenuItems back and change the image they are displaying?