瘋狂購物 App

Shiny Shih
Aug 9, 2017 · 2 min read

這次選擇的品牌是 A&F Abercrombie & Fitch ,服裝是歐美系的。

功能:

  1. 利用 stepper 來選商品數量
  2. 計算總額
  3. 清除資料

textfield 拉 outlet 來顯示商品數量。

stepper 拉 action ,並且讓 textfield 的值顯示 stepper 的 value ,因為 value 的型別是浮點數,所以要把它變成整數 Int 之後,textfield 顯示的時候才不會出現小數點。

結帳按鈕也是拉 action ,按下「結帳」便會執行計算上面三個 item 的總額,顯示在總額的 textfield。

清除按鈕拉 action 之後,把所有 textfield 的值都設為 0 ,並將所有 stepper 的 value 也設為 0 。這邊還需把 stepper 都再拉一個 outlet 出來才可以去設定它的 value 。

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

    Shiny Shih

    Written by

    彼得潘的 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