Author Topic: How to set anchors through code?  (Read 1231 times)

whilesocold

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
How to set anchors through code?
« on: July 19, 2015, 06:11:02 AM »
Hi, can you help me to get coords for setting anchor through code, like on attached image?
Best regards.
« Last Edit: July 19, 2015, 12:22:57 PM by whilesocold »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to set anchors through code?
« Reply #1 on: July 21, 2015, 11:32:08 AM »
For example:

widget.topAnchor.Set(1f, -162f);

...where "1f" means "top" in this case (0f would be bottom, 0.5f would be center, etc).

So the code above effectively means "take the target's top and subtract 162 to get the top anchor's position".