Author Topic: How to know whether can move to left,right,up,down about UIScrollView?  (Read 2129 times)

xiaoniaojjj

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 140
    • View Profile
How to know whether can move to left,right,up,down  about  UIScrollView?
Means whether reached the border (left,right,up,down)
I know the "canMoveVertically", but i don't know up or down.
« Last Edit: April 18, 2014, 10:28:24 PM by xiaoniaojjj »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
I'm not sure what you mean...

xiaoniaojjj

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 140
    • View Profile
Sorry for my english.
How to know whether has any child(UIDragScrollView gameobject)   out of the border of UIScrollView.
If has and how to know the border which out of. (top,bottom,left,right.).

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
UIPanel has functions for that -- CalculateConstrainOffset. You pass it the min/max of the content (NGUITools.CalculateRelativeWidgetBounds), and it will give you the offset required to offset the panel to make everything fit. If you need more details, just look inside the function for the math involved and create something similar.