|
Post by rzrbrn on Dec 1, 2022 1:51:41 GMT
Sorry, I'm terrible with UI.
Specifically, how would you change the detail cell view height in the 12b Nested Linked Scrollers (Alternate Grid) Demo?
I read about using GetCellViewSize to return the height for the vertical scroller, but with this example, it seems a bit more complicated.
For ex, I just want the height to be 50 instead of 100. I've gotten the cell UI elements sized correctly by setting the DetailScroller height to 50, but the instantiated MasterCellViews are still 100. Even if I change the RectTransform anchor and set height to 50 in the prefab.
The GetCellViewSize in the MasterCellView changes the width, not height. So I thought maybe I needed to change DataCellView to implement the interface / return the cell height, but since The MasterCellView already seems to set the delegate for it, I was confused on how best to change that.
TLDR; How do I change the cell height in the 12b Nested Linked Scrollers (Alternate Grid) Demo?
Thanks
|
|
|
Post by echo17 on Dec 1, 2022 12:13:58 GMT
You are correct, this example is a bit more complicated than the standard scroller. Fortunately, it is pretty simple to adjust the height. You'll need to open the MastCellView prefab and set the Detail Scroller height to 50. If you also want the rows of the main scroller to match this, you'll need to set the height in the Controller.cs script's GetCellViewSize method to 50: public float GetCellViewSize(EnhancedScroller scroller, int dataIndex) { return 50f; }
This will give you the results you want:
|
|
|
Post by rzrbrn on Dec 1, 2022 16:26:05 GMT
Thanks, that does work! although didn't for me at first.
If anyone has a similar issue, this probably won't help you, but I'll post it anyway.
I had changed the Scroller RectTransform to scale to fit the parent both horizontally and vertically. At this point changing the GetCellView to return 50 changed the cell width, not height. I changed it to just scale vertically, like the example, and it worked! I then changed it back to scale both horizontally and vertically and it worked ¯\_(ツ)_/¯
|
|
|
Post by echo17 on Dec 1, 2022 18:05:04 GMT
At this point changing the GetCellView to return 50 changed the cell width, not height. You probably changed the GetCellView return value in the MaterCellView.cs script (instead of the Controller.cs script). The Controller cells are the rows, so that would change the height. The MasterCellView cells are the individual cells that scroll horizontally, so that would change the width. I had changed the Scroller RectTransform to scale to fit the parent both horizontally and vertically. I changed it to just scale vertically, like the example, and it worked! I then changed it back to scale both horizontally and vertically and it worked I would recommend not messing with the anchors and scaling. The layout component is going to take over and control the sizes, so changing the anchors and scaling manually will give unexpected results.
|
|