iOS開發中的position+anchorPoint與frame應用解釋

來源:互聯網
上載者:User

標籤:看到了   移動   之間   一起   相對   int   frame   座標   就是   

我剛開始時非常困惑這兩個地方, 所以現在好好解釋一下他們的聯絡. 1/position與anchorPoint是一對屬性, 經常一起設定來確定控制項的位置frame單獨設定 2/position以父控制項的左上方為(0, 0), 取值無限制. anchorPoint以自己的左上方為(0, 0), 取值0-1之間.frame以父控制項的左上方為零點, 取值無限制 . 3/position與anchorPoint必定重合, anchorPoint預設值為(0.5, 0.5), position不確定 4/當我們確定了frame的位置之後, 比如說frame = (100,100,200,200). 那隨之position與anchorPoint也就確定了, 是多少呢?anchorPoint預設是(0.5, 0.5) ,因為它倆必須要重合, 所以position點要為(200, 200)才可以.看到了吧, 確定了anchorPoint, 又有frame , position就可以確定下來了. 5/確定了frame之後, 又修改它倆, 控制項會重新移動, 也就是說, 並不是說frame寫好了之後, 控制項就完全確定下來了. 6/一般來說, position與anchorPoint, 修改其中一個, 控制項都會隨著跑修改position, (100, 100) --> (200, 200), 這就相當於改了座標系的(x, y), 但是anchorPoint的值不會變修改anchorPoint, (0.5, 0.5) --> (1, 1), 這就相對於原位置, 向左上方分別移動了50%, 但是position的值不會變看, 修改其中一方, 控制項的位置是肯定要變得  

iOS開發中的position+anchorPoint與frame應用解釋

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.