Hello again,
As mentioned I managed to add items dynamically to UIDraggablePanel+UIGrid, but I found a problem where I am stuck now: when I destroy an item (e.g. when the player click on an item in the inventory, the real item prefab will spawn and so the UIDraggablePanelContents must be destroyed to not appear again in the inventory panel).
I am using the following code to destroy the content and refresh the list:
// this script is attached to the UIDraggablePanelContents
NGUITools.DestroyImmediate(gameObject);
// myGrid is a reference to the UIGrid
myGrid.Reposition();
myGrid.transform.parent.GetComponent<UIDraggablePanel>().ResetPosition();
The problem is that sometimes (not ever, but very often) the item is destroyed but the grid is rendered with an empty space where it was the destroyed cell, even if I can see in the hierarchy that the grid was correctly repositioned because its orange bounds in the editor window are correctly resized and the other items were repositioned correctly but not drawn.
Is it the correct way to remove an item from an UIGrid or I'm doing it wrong?
By the way I'm targeting iOS as output platform (using NGUI 2.0.7c), and this happens also to a modified version of the "Scroll View" example shipped with the library that you can try yourself from the attachment (it will need to be imported in a project where there is already NGUI imported).
This is very urgent, since the release date of the game is very soon and the GUI is the last thing missing.
Thanks
EDIT: I forgot to mention that as soon as I drag the list (or destroy the first element of the grid, after having destroyed another one in the middle) it is again correctly rendered without the empty space in the middle, so I'm guessing if there is a method to force the render update. I also tried to move the destroy script on another GameObject passing the object to be destroyed, but the result is the same, the object is destroyed but the grid is wrongly rendered with an empty space.