Author Topic: anchored Scrollview  (Read 4056 times)

didier

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 21
    • View Profile
anchored Scrollview
« on: January 10, 2014, 03:28:20 PM »
Hi

i have a clipped panel containing a scrollview that contains a grid and some items (sprites with colliders attached on them).
I attached the UIDragScrollView to those item (=sprite/colliders). All seems ok.

But i woul like the sprite to adapt to the screen size. So i used anchors (i use them for other widgets and its ok).
UNfortunatly i cannot seem to be able to make it work. I tried to add the anchors to either the panel, the scrollview or the items. I couldnt make them resized horizontally and vertically). Ideally the entire scrollview shall adapt to the screen size.

Is it possible to do such thing? How ? thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: anchored Scrollview
« Reply #1 on: January 10, 2014, 05:16:51 PM »
Adapt in what way? If you want it to cover a larger portion of the screen, then use the drag & drop example as your starting point. I have panels there that get anchored to the screen, and as you change the size of the screen, the scroll views shrink or grow accordingly.

didier

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 21
    • View Profile
Re: anchored Scrollview
« Reply #2 on: January 13, 2014, 01:18:36 AM »
Adapt in the "autoscale" way. Keep my widgets size the same proportion of the screen size, whatever the resolution is.

But in fact it works like a charm: i forgot to the change the scaling type of UIRoot to FixedSize. I changed it as and now my GUI looks (almost) perfect :)

dwilday

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: anchored Scrollview
« Reply #3 on: January 31, 2014, 05:23:59 PM »
@ArenMook
I'm having the same issue.  Looking over your example I see some great ideas but mainly you make this work using the deprecated UIAnchor class.  Is this the recommended way to do this?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: anchored Scrollview
« Reply #4 on: February 01, 2014, 12:36:55 PM »
No, you should not be using UIAnchor anymore. Thanks for bringing it to my attention. You should remove UIAnchors altogether.