Author Topic: Set initial value for UIScroll View  (Read 4146 times)

fanling3

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 29
    • View Profile
Set initial value for UIScroll View
« on: July 07, 2014, 02:42:48 AM »
I have an UIScroll View, any way to initialize where I start from? Something like UIScrollbar.value
Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Set initial value for UIScroll View
« Reply #1 on: July 07, 2014, 04:16:07 AM »
You can set the scroll view's content origin and ResetPosition().

fanling3

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: Set initial value for UIScroll View
« Reply #2 on: July 07, 2014, 08:45:01 PM »
Sorry, maybe my question is not clear enough.

I mean I have, for example, 10 UIDrag Scroll View Objects, and I want to stay on, let's say, the 3rd objects when I enter the scene, in stead of the 1st one.

Like when you use ScrollBar, you initialize ScrollBar.value to change where you start at the beginning.

EDIT: Ok, I figure it out myself by using:
  1. scrollView.MoveRelative(new Vector3(x, y, z));
  2. scrollView.ResetPosition();
« Last Edit: July 08, 2014, 04:18:56 AM by fanling3 »