private void createItem() { List <TreeMenuItemVO> vo = new List <TreeMenuItemVO>(); for (int i = 0; i < 4; i++) { TreeMenuItemVO itemi = new TreeMenuItemVO(); itemi.ItemName = "songyu" + i; itemi.name = "宋玉0"; vo.Add(itemi); List <TreeMenuItemVO> treeis = new List <TreeMenuItemVO>(); itemi.treeMenuItemVO = treeis; for (int j = 0; j < 4; j++) { TreeMenuItemVO itemj = new TreeMenuItemVO(); itemj.ItemName = "caidan" + j; itemj.name = "宋玉1"; treeis.Add(itemj); List <TreeMenuItemVO> treejs = new List <TreeMenuItemVO>(); itemj.treeMenuItemVO = treejs; for (int k = 0; k < 4; k++) { TreeMenuItemVO itemk = new TreeMenuItemVO(); itemk.ItemName = "yezi" + k; itemk.name = "宋玉2"; treejs.Add(itemk); } } } setValue(vo); }
/// <summary> /// 设置标签上显示的文字 /// </summary> /// <param name="vo"></param> public void setValue(TreeMenuItemVO vo, TreeMenuItem parent) { this.parent = parent; this.value = vo; lable.text = vo.name; }