訂飲料App(5),搖晃手機隨機選飲料
Published in
2 min readMay 7, 2019
- 將原本訂單頁面的飲料欄位從Label改成PickerView
- 在main.storyborad設定PickerView的data source和 delegate
- 讓viewController遵從pickerView的protocol
- 實作pickerView的protocol
- 讓pickView顯示user選的飲料
2. 加入搖晃手機隨機選飲料的功能
使用 Int.random(in: 0..<drinks.count)
隨機選取一個index