void TabOnChange() { UIToggle toggle = UIToggle.current; if (toggle.value) { UIToggleRender tRender = toggle.GetComponent <UIToggleRender>(); if (tRender != null) { TriggerRenderEvent("OnChange", tRender.data); } } }
protected override void UpdateView() { base.UpdateView(); int length = _data != null ? _data.Length : 0; if (length <= 0) { ClearData(); return; } for (int i = 0; i < length; i++) { UIToggle toggle; toggle = _toggleCache.PushRender(i); toggle.group = _groupId; EventDelegate.Add(toggle.onChange, TabOnChange); if (i == 0) { toggle.startsActive = true; } UIToggleRender tRender = toggle.GetComponent <UIToggleRender>(); if (tRender != null) { tRender.data = _data[i]; tRender.owner = this; } } _toggleCache.Release(); table.Reposition(); }