【iOS App】模仿製作 iOS Clock App — 計時器 Timer

Patty
4 min readAug 15, 2022

--

實作內建時鐘計時器分頁的功能,盡可能達到和內建相同的設計和功能。主要實作和學習的三個重點:TimerLocal NotificaitonUIPickerView、AVPlayer 和套件 CodableCSV 解析 csv,其他則是複習之前所學過的 UITableViewController、UIButton、UILabel。

實作功能和學習重點

技術

  • Timer:設置 Timer、解決 Timer 在 App 於背景時無法執行的對應
    應用:更新倒數計時顯示的數字以及更新倒數的時間
  • Local Notification:本地推播
    應用:倒數計時時間到則推播通知
  • UIPickerView:UIPickerView 客製化設計
    應用:實作於選擇時間
  • AVPlayer:播放 App 當中的音檔
    應用:選擇鈴聲時試聽
  • 透過第三方套件 CodableCSV 解析 csv:解析音檔相關資訊
    應用:表格呈現音檔名稱、透過 AVPlayer 播放時需要的檔案檔名和副檔名

需求

目標:
以時間滾輪選擇器決定計時的時間(小時、分、秒)倒數計時,時間到則跳出推播通知

設計:
➤ 在選擇鈴聲的列表時,點選該鈴聲則播放音樂
➤ 開始按鈕依狀態:初始(綠色、"開始")、開始後(橘色、"暫停")、暫停後(綠色、"繼續")
➤ 取消按鈕依狀態:初始、取消後(不可以使用)、開始後(可以使用)

限制:
當時間選擇皆為0則開始按鈕無法使用

Sign up to discover human stories that deepen your understanding of the world.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response