var rtf = GetComponent<RectTransform>(); rtf.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 200);
SetSizeWithCurrentAnchors不会改变anchorMin和anchorMax
设置大小会根据pivot的值,往两边扩充
var rtf = GetComponent<RectTransform>(); rtf.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 640-50, 200);
SetInsetAndSizeFromParentEdge会改变anchorMin和anchorMax
设置大小时,Edge为Left往右边扩充,Edge为Right往左边扩充,Edge为Top往下扩充,Edge为Bottom往上扩充
标签:rtf,api,anchorMax,RectTransform,Edge,设置,扩充 From: https://www.cnblogs.com/sailJs/p/17436038.html