Thx, but what I mean is how can I add child item in UIGrid...?? The item is a game object prefab...which is a group of game object containing s a few UILabels, UISplite, etc)
Post edit***********************************
I guess I just found the answer..not tried yet: just set the parent property should be fine.
GameObject GridItem = Instantiate(GameObject.FindGameObjectWithTag("listitem")) as GameObject;
GameObject Grid = GameObject.FindGameObjectWithTag("list");
ListItem.transform.parent = List.transform;
Post Post edit***********************************
The code above nearly work...but two thinks to remind...
1. you will not see the sprite sometimes, you have to set the prefab depth of some item higher...donno why, the original item in the list is 3 and I can see, while on the fly new item have to be 4 or 5 in order to be seen. luckily you can easily preset it on the prefab.
2. Have to run UIGridInstance.Reposition(); one times to update the graph but after update,
3. The scale of the newly added listitem will changed weirdly after ....have to set back to 1 after reposition.
GameObject GridItem = Instantiate(GameObject.FindGameObjectWithTag("listitem")) as GameObject;
GameObject Grid = GameObject.FindGameObjectWithTag("list");
ListItem.transform.parent = List.transform;
thegrid.Reposition();
ListItem.transform.localScale = new Vector3(1, 1, 1);