void InitScrollview1() { List <Lzh_LoopItemData> datas = new List <Lzh_LoopItemData>(); for (int i = 0; i < 100; i++) { Lzh_LoopItemData data = new Lzh_LoopItemData1(i.ToString()); datas.Add(data); } loopSV1.Init(datas, OnItemInit1); }
void OnItemInit1(Lzh_LoopItemObject item, Lzh_LoopItemData data) { Lzh_LoopItemData1 myData = data as Lzh_LoopItemData1; lzh_LoopItemTest1 itemComp = item.widget.GetComponent <lzh_LoopItemTest1> (); string front = "item:"; if (item.dataIndex % 3 == 1) { front += "\n"; } else if (item.dataIndex % 3 == 2) { front += "\n\n"; } itemComp.lblName.text = front + myData.name.ToString(); item.widget.height = itemComp.lblName.height + 18; }