天天看点

NGUI UILabel计算文字行数

NGUIText类中的静态方法

public UILabel textLabel;
	private string text2;
	// Update is called once per frame
	void Update () 
	{
		if (this.textLabel != null && this.textLabel.font != null) 
		{

			NGUIText.WrapText( textLabel.text, out text2 );
			string[] lines = text2.Split('\n');
			Debug.Log( "lines = " + lines.Length );
		}
	}
           

继续阅读