聰明猜出元件如何排列的 stack view

stack view 十分聰明,他可以單憑 storyboard 裡元件排列的情形,猜出我們想要由上而下還是由左而右排列。而且不僅於此,他連我們想如何對齊都猜得出來。接下來,彼得潘就以最近我重覆播放一百遍的演員歌詞為例說明 :

置左:

將四個 label 大約地置左排列後,將它們全選,點選右下角的 Embed In Stack 按鈕,四個 label 將乖乖地被包在 stack view 裡,由上而下地置左對齊排列。

置中

置右

彼得潘的 Swift iOS App 開發問題解答集

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

彼得潘的 iOS App Neverland

Written by

彼得潘的 Swift 程式設計入門,App程式設計入門作者,彼得潘的iOS App程式設計入門,文組生的iOS App程式設計入門講師,http://apppeterpan.strikingly.com

彼得潘的 Swift iOS App 開發問題解答集

彼得潘和學生們在開發 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