[ 作業 ] BMI 計算機 1.0

jony wu
jony wu
Aug 31, 2018 · 2 min read

目的:學習將兩個以上 UISlider 加在同一個 IBAction

製作工時:約6小時

預設裝置:IPHONE SE ( Landscape 1136px * 640px )

UI 參考https://dribbble.com/shots/1026112-BMI-Calculator

條件:運用兩個 UISlider 分別設定身高、體重兩個參數來計算 BMI 值。背景圖片會依 BMI 數值高低,顯示其體態。

學習心得:UISlider有點有趣,需要拉 IBAction 和 IBOutlet 兩條線,IBOutlet 那邊會自動接收由 IBAction 傳來的數值。

在這個作業,我們可以先寫一個BMI 的計算方式,

藉由輸入的數值來計算 BMI 值,並存進常數中

最後在依數值大小,判斷需置入的圖片


完成圖 and 完整程式碼

彼得潘的 Swift iOS App 開發教室

學習 Swift iOS App 開發的學生作品集

jony wu

Written by

jony wu

彼得潘的 Swift iOS App 開發教室

學習 Swift iOS App 開發的學生作品集

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade