1
NGUI 3 Support / Re: Forcing a UIScrollView contents to "spring" to the top when not full
« on: January 27, 2016, 01:02:39 AM »
I got the same problem too,my solution is below:
;Dit's works well
- private UIScrollView scrollView;
- private Vector3 startPos = Vector3.zero;
- private void dragFinished()
- {
- if (scrollView != null)
- {
- if (!scrollView.shouldMoveVertically)
- {
- if (scrollView.dragEffect == UIScrollView.DragEffect.MomentumAndSpring)
- {
- // Spring back into place
- SpringPanel.Begin(scrollView.GetComponent<UIPanel>().gameObject, startPos, 13f).strength = 8f;
- }
- }
- }
- else
- {
- Debug.Log("grid or scroll view is null FUNC:dragFinished POS:PackageTypeClick.cs");
- }
- }
- private void dragStart()
- {
- scrollView = CurrentScrollView.GetComponent<UIScrollView>();
- startPos = scrollView.gameObject.transform.localPosition;
- }
;Dit's works well
