Swift iOS 使用程式碼設定Tab

Setting tab path & image with code

Tab的使用頻率很高,設定上我們常常是用StoryBoard拉線、設定等等。

有時候線一多就有點煩躁。我們其實可以從code做到。

By MarioTsai

首先在 func 裡面設定 陣列

加入StoryBoard,使用關鍵字.tabBarItem,再設定點選的圖片。最後append進去就可以了。

有一個以上的tabBar就繼續 if let下去就可以了。

Coding Swift 順利

--

--

Major in physical education. Football referee. And high interest in looking the world through the numbers.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mario tsai

Major in physical education. Football referee. And high interest in looking the world through the numbers.