Author Topic: Two ScrollView questions  (Read 1670 times)

pretender

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 155
    • View Profile
Two ScrollView questions
« on: February 04, 2015, 07:39:02 AM »
Hi!

I am more than happy user of NGUI and I use scrollview component a lot, but I frequently encounter two things with it that I would like to resolve finally.
1.) I usually have structure like this:

UIScrollView
   UITable
    (dynamically created items -> for example UISPrite)

so if I at one point have enough items to make table scrollable it scrolls fine but next time when there isn't enough items in the scrollview/table that will cause to scroll it will scroll (even if "Cancel drag if it fits" is set to true)...this happens if I use drag before clicking on the scrollview...I tried everything that I could to reset position,clipping, to reposition table,etc....but no luck. Question is what is the proper way to reseting the scrollview after populating dynamically contents?

2.) When I slide scrollview, for example from left to center of the screen, elements in the scrollview appear to slide more than scrollview and then snap back to proper place. Also when scaling scrollview from 0.1 to 1 for example, for visual effect, often elements in the scroll view doesn't properly position themselves, they snap back when scrollview is clicked/dragged. Is there any workaround for this?

Thanks a lot!

StabbAmonte

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 7
    • View Profile
Re: Two ScrollView questions
« Reply #1 on: February 04, 2015, 10:29:56 AM »
1) After adding all the dynamic objects to your UITable  call UITable.Reposition() then call UIScrollView.ResetPosition()

2) Sounds like you might have the "Restrict within Panel" option set to true. You need to disable that if you want to be able to slide objects off the panel and not snap back into on the panel when you let go after dragging.  "Restrict within Panel" is a check box in your inspector when you select your UIScrollView in the scene.
« Last Edit: February 04, 2015, 10:35:30 AM by StabbAmonte »