storyboard 裡指定第一個畫面 controller 的箭頭不見了 !

iOS App 啟動後,會先顯示一兩秒鐘的開頭畫面,接著再顯示 storyboard 裡被箭頭指到的 controller 畫面。

如下圖所示,左邊帥氣的彼得潘畫面被箭頭指到,所以 App 啟動後,看到的會是彼得潘的圖片,而不是邪惡的虎克船長。

Document Outline 裡被箭頭指到的 controller 下也可以看到箭頭,英文名字是 Storyboard Entry Point。

經由控制箭頭指到的 controller,我們可以決定誰是第一個畫面。但是,倘若如下圖所示,你不小心讓箭頭不見了,沒有任何 controller 被箭頭指到,將發生很可怕的事情 !

結果

App 啟動後,使用者將看到一片漆黑的黑色畫面,什麼都不能做,只能心裡偷偷對著 App 開發者 os: “不懂你的黑色幽默,我要給你留下一顆星的負評 ! ”

解法

1 在 storyboard 裡點選想成為第一個畫面的 controller,

2 在它的 Attributes inspector 頁面勾選 Is Initial View Controller,讓箭頭再度現身 !

Is Initial View Controller

單字解說

Initial

彼得潘和學生們在開發 iOS App 路上曾經解決的問題集

彼得潘的 iOS App Neverland

Written by

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