Author Topic: UIScrollView  (Read 127061 times)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UIScrollView
« Reply #90 on: July 09, 2014, 02:40:41 PM »
Content origin point -- it's set on the scroll view. Judging by you mentioning that resizing the unity player window causing the "jump", I'm going to guess that you have the scroll view anchored. Anchors are updated in the Update() function as well, same as your custom script. You can try modifying the script execution order in order to make your script execute after the Default Time so that its logic runs after the anchors have been updated.

You can force update scroll bars via UIScrollView's UpdateScrollbars() function. You can also reset the scroll bar's position after repositioning your items by simply updating the scroll bar's value.

HeavensSword

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: UIScrollView
« Reply #91 on: July 22, 2014, 10:29:22 AM »
Hello, I'm creating a type of chat log using a UITable full of UILabels and a UIScrollView.

In order to conserve memory I would like to only use a pool of 10 UILabels in an array (only 8 lines of text are visible anyways), but would like to scroll as if there were more (we're capping the max messages in the log to about 100).

So essentially I was wondering if there was a way for me to control the size of the scroll bar to fake there being more child UILabels than there actually are, giving the illusion that the user is scrolling through more than just 10.

Thanks in advance, and let me know if you need any clarification.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UIScrollView
« Reply #92 on: July 22, 2014, 08:38:01 PM »
The only way to do this would be to use the UIWrapContent script instead of a table. Just note that it positions things like a grid, without considering the widget's size like the table does.

HeavensSword

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: UIScrollView
« Reply #93 on: July 23, 2014, 09:43:55 AM »
Thanks ArenMook, i'll give it a try!

jmansa

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 11
    • View Profile
Re: UIScrollView
« Reply #94 on: September 10, 2014, 02:23:09 PM »
I was wandering if its possible to only render the items visible in the scrollview. Lets say I have a scrollview which fits about 8 items but my item list is on 50 items. Then I, as it is now, have to render all 50 and making the scrollview heavy!? Is there a function I am missing or is this not possible?

Hoping for help and thanks in advance :-)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UIScrollView
« Reply #95 on: September 11, 2014, 01:49:20 AM »
UIPanel has an option to cull the contents while dragging. Contents are culled automatically when not dragging the scroll view whether it's on or off. Objects that are culled don't get rendered.

RDeluxe

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Re: UIScrollView
« Reply #96 on: September 24, 2014, 10:45:19 AM »
Hi Aren,

I don't really get why my scrollview is not resetting its position when I'm dragging top. Here is a gif showing what happens :


I don't really get why the scrollview is not repositionning its content correctly (at its top). Note that this happens only if there is not enough elements to vertically fill the scrollview.

Another problem that I face is that my grid elements go out of the UIPanel/UIScrollview :

Edit : This problem has been solved with a "Soft Clip" panel ... Sorry ;)

Here is my set up :



"Restrict within panel" and "contraint within panel" are both checked.
« Last Edit: September 24, 2014, 11:06:18 AM by RDeluxe »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UIScrollView
« Reply #97 on: September 24, 2014, 02:48:55 PM »
Scroll view won't reposition your content to the top if it fits. "Disable Drag if Fits" is one of the options on the scroll view. Otherwise you will be able to move the content around your scroll view freely.

RDeluxe

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Re: UIScrollView
« Reply #98 on: September 24, 2014, 03:29:26 PM »
Thanks. I'll use "disable if fits" for now, but I think that this kind of behavior can be quite nice (considering it's a basic one on iOS and Android, and well known to the users) :)

kennethljj

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: UIScrollView
« Reply #99 on: September 26, 2014, 02:50:57 AM »
Hi Aren,

Thanks for your clarification on my previous post regarding the limitations. I have another question regarding scroll view. Is it possible when the dragging ends, it will center to the nearest child object?

Eg. I have 2 instruction page and the user is to swipe left or right to view the pages. When the user swipe left it shld go to the next page and not stay in the middle of the 2 pages. I have a scroll bar that I have set the value to 2. It works perfectly when i use the scroll value but not in the case when the user drags the child object.

Hope you understand what I explained. Thanks in advance  :D

EDIT:

I have found the solution to this. :D
Decided to add the solution here for those who are looking for it as well. This is what my hierarchy looks like now:

UIScrollView
- UIGrid , UICenterOnChild
  ~ UIDragScrollView Objects
  ~ UIDragScrollView Objects

For more information, look at ngui scene example 7 :D
« Last Edit: September 26, 2014, 04:04:59 AM by kennethljj »

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: UIScrollView
« Reply #100 on: October 06, 2014, 10:50:56 AM »
How can I edit the Spring Panel strength in my UIScrollView?
I want it to spring but just a little.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UIScrollView
« Reply #101 on: October 07, 2014, 10:51:34 AM »

sx1n90

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: UIScrollView
« Reply #102 on: October 17, 2014, 09:39:39 AM »
How can i restrict overscroll amount when using MomentumAndSpring ???

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UIScrollView
« Reply #103 on: October 18, 2014, 09:06:45 AM »
There is no such code in place.

ababab5

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 34
    • View Profile
Re: UIScrollView
« Reply #104 on: November 14, 2014, 01:50:07 PM »
Hi,

I have an issue with the "touchable area" of my scroll view.

Please see this video of my issue :

https://www.dropbox.com/s/ro826crci029ic0/UIScrollView%20touch%20area%20issue.mp4?dl=0

How can I restrict the touch area to the UIPanel (all the size), and of course my widgets continue to go up if I swipe to the top , and go down if I swap to the bottom.


Thank you very much for your help.

Best regards,

AB