可設定Stack View的axis, alignment, distribution, spacing, layoutMarginsRelativeArrangement, baselineRelativeArrangement,或是調整Stack View裡的元件,製作動畫效果。

範例:

@IBAction func handleTap(sender: AnyObject) {   UIView.animateWithDuration(1, animations: {      if self.contentStackView.axis == .Horizontal {          self.contentStackView.axis = .Vertical      }
else {
self.contentStackView.axis = .Horizontal } }, completion: nil)}

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

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