Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: par on February 28, 2014, 08:11:50 PM

Title: Detect which grid cell is active (centered on) when inside UIScrollView
Post by: par on February 28, 2014, 08:11:50 PM
This is probably an easy answer but I've been wasting my time trying to figure it out and hope that someone here can enlighten me.

I have a simple UIScrollView with a simple UIGrid inside it.  Inside the UIGrid I have 5 UIWidgets with UIDragScrollView and UICenterOnClick added to them.

Everything works perfectly.  With that said, I need to know when one of the 5 UIWidgets is "centered" on when its finished "centering" in the scroll view.  Is there a callback anywhere that accomplishes this easily?

Thanks!

PAR
Title: Re: Detect which grid cell is active (centered on) when inside UIScrollView
Post by: ArenMook on February 28, 2014, 09:15:40 PM
UICenterOnChild has this functionality, and you can rip the code from it if you don't want it to actually do the centering.
Title: Re: Detect which grid cell is active (centered on) when inside UIScrollView
Post by: par on February 28, 2014, 09:48:21 PM
Alright thanks!  I ended up snagging the code for UICenterOnClick and overriding the OnClick to do what I want along with calling what it calls by default.

Thanks much!

PAR