How to create UI elements Dynamically?

Is there any way to create UI elements Dynamically?

For example:
I have an inventory panel which contains some item icons.
[57550-qq截图20151104175827.png|57550]

When i open the this panel, i need to create a number of item icons according to a variable.
So how can i create these icons with the right number and make them in the right order in the panel?

Should i use a prefab and create it as a child of the panel, then set its rect-transform manually?

thx~

The Learn link at the top has some good tutorials on using the UI. The one on creating scroll lists at runtime is a pretty good one and should be helpful for this.