|
Post by rzrbrn on Nov 29, 2022 22:28:55 GMT
Is it possible to have a fixed header that scrolls horizontally with the rows, but not vertically? As an example I almost have it working on my own, but would prefer to use the enhancedscroller features. (if this is too small, see: paste.pics/a1593d1a2ae34ad3d2757b3eaefed4b6 ) Maybe I'm missing something, but I'd think this is the first thing most people want with a scroll view. Just a standard table, yet it's taken me weeks to get even this far in Unity's UI...
|
|
|
Post by echo17 on Nov 30, 2022 14:03:28 GMT
There are probably a lot of ways to do this, but what I would recommend is to have two separate scrollers: one for the header that only has a single row and scrolls horizontally, and one for the main rows of the table. In your controller, you can set the delegate for when the scroller changes position and then update the position of the header scroller to match.
So something like this in your controller's Start method, assuming your main scroller is called scroller and your header scroller is called headerScroller:
scroller.scrollerScrolled = ScrollerScrolled;
And then somewhere in your controller, define the ScrollerScrolled callback that will match the scroll position of the header to the main scroller:
private void ScrollerScrolled(EnhancedScroller scroller, Vector2 val, float scrollPosition) { headerScroller.ScrollPosition = scroller.ScrollPosition; }
|
|
|
Post by rzrbrn on Dec 1, 2022 1:18:46 GMT
Thank you, that worked.
|
|