Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: amirivala on December 06, 2014, 07:28:27 PM

Title: Scrollview Position Problem
Post by: amirivala on December 06, 2014, 07:28:27 PM
Hi, I have a problem with the scroll view when i change the position and clipping size and center, Actually I'm using this code when the screen orientation changed to landscape mode to change the position and clipping size:
  1. if (Screen.orientation == ScreenOrientation.Landscape)
  2.                         {
  3. profileScroll.GetComponent<UIPanel>().clipRange = new Vector4 (7, 274, 902, 1000);
  4.                                 profileScroll.transform.localPosition = new Vector3(0,-204,0);
  5. else if (Screen.orientation == ScreenOrientation.Portrait)
  6.                         {
  7. profileScroll.GetComponent<UIPanel>().clipRange = new Vector4 (7, 88, 902, 1372);
  8.                                 profileScroll.transform.localPosition = new Vector3(0,0,0);
  9.  
  10.                         }
and every things works fine, but when i go to land scape mode and use the scroll view, when i came back to Portrait mode the position of scroll view is wrong! i donna what to do to make it stays in its correct position!
Please help me
cheers
Title: Re: Scrollview Position Problem
Post by: ArenMook on December 07, 2014, 12:25:34 AM
Note the comment above clipRange:
  1.         /// <summary>
  2.         /// Clipping position (XY) and size (ZW).
  3.         /// Note that you should not be modifying this property at run-time to reposition the clipping. Adjust clipOffset instead.
  4.         /// </summary>
Plus the whole property is also marked as obsolete:
  1. [System.Obsolete("Use 'finalClipRegion' or 'baseClipRegion' instead")]
You should be adjusting clipOffset to alter the position. Transform shouldn't be touched at all. What version of NGUI are you using?
Title: Re: Scrollview Position Problem
Post by: amirivala on December 07, 2014, 11:16:12 AM
Thank you for your reply, I'll trying to fix it based on what you've said I'm using NGUI 3.7.1
Title: Re: Scrollview Position Problem
Post by: amirivala on December 07, 2014, 11:38:09 AM
Sorry, Maybe its stupid question and I'm new to coding but the problem with changing the offset is it won't change the position of the bottoms that are inside the scroll view and it only changes the clipping offset, how should change the position of the buttons that are inside the scroll view??
Thank you
Appreciate it
Title: Re: Scrollview Position Problem
Post by: amirivala on December 07, 2014, 11:54:19 AM
and how i can change the Scrollview clipping size, I have to change the size to fit in the Landscape mode.
Title: Re: Scrollview Position Problem
Post by: amirivala on December 07, 2014, 12:16:01 PM
Ive made it!
Ive added a Panel above the ScrollView and i change the position of it instead of transform.position of Scroll view, and it works fine
Thank you So Much
Appreciate it