Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - gianis6

Pages: [1]
1
I tried also the method you posted in the last post, but the value continues to be wrong.
I add som extra info in case it can help.  The label I'madding are placed inside a scrollview

2
Reading the label.height property the way I posted returns a bigger value than the one shown in the editor. It seems that if try to read the height property just after I set the text of the label I get an incorrect value like if the label hadn't resized yet.
I tried to read the height property in a second moment (not just after having set the text) and the value I got is correct, so I think the problem is related to the fact of reading "too early".
Are there any ways to solve this problem?

3
I modified the script but it seems to have not solved the problem. The height value I get is still wrong.
Here is the snippet:
  1. GameObject goTextIn = NGUITools.AddChild(topAnchor.gameObject, textsLabel);
  2. UILabel textIn = goTextIn.GetComponent<UILabel>();
  3. textIn.text = "dynamic text which can be very long";
  4. textIn.transform.localScale = new Vector3(1f, 1f, 1f);
  5. textIn.transform.localPosition = new Vector3(25f, currentY, 0);
  6. Vector2 tmpSize = textIn.localSize; // also tried with printedSize and processedText properties
  7. Debug.Log(textIn.height); // the value is still wrong
  8.  

Am I missing something?

4
Hello,

I am using UILabel with Overflow property set to 'ResizeHeight' as a Prefab. Every time I instantiate a new one label of this type I try to read the property height but its value is wrong (while the height shown in the editor is correct)

Here is the piece of code I use to get the Label's height:
  1. UILabel textIng = Instantiate(textsLabel) as UILabel; // textsLabel is the prefab I use
  2. textIng.text = "my dynamic text here sometimes it can be very long";
  3. textIng.transform.parent = topAnchor; // topAnchor is the anchor where I attach the label
  4. textIng.transform.localScale = new Vector3(1f, 1f, 1f);
  5. textIng.transform.localPosition = new Vector3(25f, currentY, 0); // currentY is an incremental variable I use to display one label below another
  6.  
  7. Debug.Log(textIng.height); // this returns the wrong height value while in the editor I can see it correct
  8.  

Any help would very appreciated
Thanks in advance

5
NGUI 3 Support / UIScrollView Detect Start Dragging
« on: April 14, 2014, 10:53:36 AM »
Is it possible to detect when the a user begin to drag the scroll view?

Pages: [1]