Author Topic: Enable scrolling of a scroll view when items are full (dont fit alltogether)  (Read 2963 times)

moghes

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Hello,

I have a scroll view which start with 0 items, and the user adds throughout the game, meaning I do not have  a fix number of items
for my scroll view.

I am facing a problem making the scroll view stop its scrolling property when not needed, ie when my vertical list fits 5 items and I only
have 2 or 3 items, no need to scroll them and let them be sorted from top to down until they dont fit and scrolling will be enabled.

Is this doable? and if yes any hint or link or tutorial please.

Thanks,
moghes

moghes

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Well there's a partial solution like we count the number of items which fit vertically and enable the scroll when item count exceeds max number,
but this is not the optimal solution since it will differ a bit from device to another, also max number will change every time we use this tecnique since
each item (row) will have a different vertical height.

so I am searching for a dynamic method, to tell me that the items do not fit without a scroll.

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
"Cancel Drag If Fits" is an option on the UIScrollView.

moghes

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Wow that was so simple and many thanks :D