RectTransform transform = GetComponent<RectTransform>();
transform.offsetMin = new Vector2(0,42);
transform.offsetMax=new Vector2(0,-62);
Anchors min=(0,0)、Anchors max=(1,1),
通过RectTransform 的属性offsetMin,offsetMax来实现;
right,top要传入负数;
offsetMin 是vector2(left,bottom);
offsetMax 是vector2(right,top);