iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 5
0
Mobile Development

從零開始-30日練習開發iOS APP系列 第 5

從零開始-30日練習開發iOS APP-AutoLayout Day-5

前文:
每個人拉約束的方法都不太一樣,而目前小弟抱持著只要UI沒跑板,在不同裝置間能正常使用就好的心態
至於拉約束的方法,目前我是採用這兩種

正文:
第一種:設置 Autoresizing ,會依照版面的比例縮放UI
https://ithelp.ithome.com.tw/upload/images/20200916/20129715IBXwcwab9J.png
https://ithelp.ithome.com.tw/upload/images/20200916/20129715FdM1oYOgxh.png

第二種:(我這幾天實作才發現的)只設定 width 跟 Height , Autoresizing 不要設置,會固定長寬,並且不同裝置間會依照相對位置排版,缺點是當UI很多時,大小太大的UI可能會蓋到其他UI
https://ithelp.ithome.com.tw/upload/images/20200916/20129715gowYc5NJda.png
https://ithelp.ithome.com.tw/upload/images/20200916/201297151QitJrDPuT.png

當然也還有其他方法
https://ithelp.ithome.com.tw/upload/images/20200916/20129715xY0pEiDsqS.png
https://ithelp.ithome.com.tw/upload/images/20200916/20129715tiDj6V5O9W.png
https://ithelp.ithome.com.tw/upload/images/20200916/20129715erTA6IuBAz.png
不過本篇不採用,就不加以介紹


上一篇
從零開始-30日練習開發iOS APP-新增ViewController Day-4
下一篇
從零開始-30日練習開發iOS APP-頁面間傳值Segue Day-6
系列文
從零開始-30日練習開發iOS APP30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言