2

I made the Scrollable View in NGUI using following tutorials Here but how can I use button to scroll the objects. Like If i click on up button it ScrollView should be up and If i click on down ScrollView should be down.

Your help will be appreciated. Thanks.

enter image description here

Pawan Chaurasiya
  • 881
  • 2
  • 16
  • 30

2 Answers2

3

I just figure out how to do this.

SpringPanel.Begin ( GameObject go,Vector3 pos,float strength ) 

here GameObject is NGUI gameObject such as ScrollView and pos is position what amount should scrollview move and strength is that related to speed. hope you will find useful.

Pawan Chaurasiya
  • 881
  • 2
  • 16
  • 30
  • Hey there, can you give in the additional details on HOW EXACTLY did you achieve this in NGUI? Because this seems like a static method and how is spring panel refereed and in which script. Please provide addition details. Thanks – Siddharth-Verma Dec 12 '14 at 09:18
  • `Begin` is a `SpringPanel` static method, see reference [here](http://www.tasharen.com/ngui/docs/class_spring_panel.html). – kreys Dec 12 '14 at 11:37
  • Hi @user1683989 i just explain about spring.panel hope it is useful for you. – Pawan Chaurasiya Dec 13 '14 at 11:21
2

You can do two different things to have scrolling button, depending what do you mean.

  1. If you want to have a scroll button, you should create UIScrollBar component, which you will attach to you UIScrollView as a horizontal or vertical scroll bar. See NGUI examples included to the package.
  2. If you want to have a object on your list, which clicked will allow you to drag the UIScrollView, you should attach to this gameObject a UIDragScrollView component. It will allow you to drag-to-scroll behavior, similar to mobile list dragging experience. Again, such example should be included to the package.

EDIT: After your question clarification, the answer should be a bit different.

You should write a script, with a reference to your UIScrollView and then you should call on it MoveRelative( Vector3 relative ) or MoveAbsolute( Vector3 absolute ), which will move the scroll view.

kreys
  • 987
  • 4
  • 21
  • actually i want a arrow button up and down. when i click on up button is should go up and if i click on down button it should go down like such functionality. – Pawan Chaurasiya May 13 '14 at 08:46
  • Ok, so you should clarify your question, to be precise about what are you asking. – kreys May 13 '14 at 08:52
  • ok i will always clarify my question. actually i am little bit in rush. – Pawan Chaurasiya May 13 '14 at 08:53
  • How it should move smoothly. Because code i have written is reaching to target position directly. – Pawan Chaurasiya May 13 '14 at 09:29
  • You can implement your own `Tween` - inherit from base class `UITweener` and on OnUpdate call one of the `Move` functions with actual delta time (there should be small move values). Then on button you should start your tween. See `UITweener` reference: http://www.tasharen.com/ngui/docs/class_u_i_tweener.html#a079f453157c77ba20ad43cfb10683187 – kreys May 13 '14 at 09:34
  • Hey there, can you give in the additional details on HOW EXACTLY did you achieve this in NGUI? – Siddharth-Verma Dec 12 '14 at 09:18