iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 27
0
Mobile Development

IOS 基本元件運用和套件運用系列 第 27

(Day27)Xcode 11 UI PickerView

UI PickerView簡單來講就是可滾動的TableView。這篇文章會介紹UI PickerView。

在Storyboard添加UI PickerView

https://ithelp.ithome.com.tw/upload/images/20201010/20129678mJjo7gZFWS.png

https://ithelp.ithome.com.tw/upload/images/20201010/20129678ZBFWzIpxyJ.png

委任

使用PickerView需要委任,在UIViewController後面加上UIPickerViewDelegate和UIPickerViewDataSource
https://ithelp.ithome.com.tw/upload/images/20201010/20129678sxqEbwr7eF.png

加了這兩個後會報錯這時按fix會多出兩個Func。
https://ithelp.ithome.com.tw/upload/images/20201010/201296784fTF7DyLFW.png
因為是func把他移到ViewDidLoad下面

然後設定delegate和dataSource.
https://ithelp.ithome.com.tw/upload/images/20201010/20129678AeaF8pB59M.png

設定

https://ithelp.ithome.com.tw/upload/images/20201010/20129678aZIxEAsZFZ.png


上一篇
(Day26)Fastlane 截圖
下一篇
(Day28)Xcode11 Navigation Bar
系列文
IOS 基本元件運用和套件運用30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言