美文网首页
UIStackView

UIStackView

作者: AT19 | 来源:发表于2018-01-19 11:25 被阅读20次

1.UIStackView: 管理子视图,自动适配。@available(iOS 9.0, *)

/* A stack with a horizontal axis is a row of arrangedSubviews,
and a stack with a vertical axis is a column of arrangedSubviews.
 */
open var axis: UILayoutConstraintAxis


/* The layout of the arrangedSubviews along the axis
枚举值
case fill
case fillEqually
case fillProportionally
case equalSpacing
case equalCentering
 */
open var distribution: UIStackViewDistribution


/* The layout of the arrangedSubviews transverse to the axis;
 e.g., leading/trailing edges in a vertical stack
 */
open var alignment: UIStackViewAlignment


/* Spacing between adjacent edges of arrangedSubviews.
 Used as a strict spacing for the Fill distributions, and
 as a minimum spacing for the EqualCentering and EqualSpacing
 distributions. Use negative values to allow overlap.
 
 On iOS 11.0 or later, use UIStackViewSpacingUseSystem (Swift: UIStackView.spacingUseSystem) 
 to get a system standard spacing value. Setting spacing to UIStackViewSpacingUseDefault 
 (Swift: UIStackView.spacingUseDefault) will result in a spacing of 0.
 
 System spacing between views depends on the views involved, and may vary across the 
 stack view.
 
 In vertical stack views with baselineRelativeArrangement == YES, the spacing between 
 text-containing views (such as UILabels) will depend on the fonts involved.
 */
open var spacing: CGFloat

2.添加方式:
1.>UIStoryBoard方式添加: 简单添加子视图适配即可

xib 添加方式
2.>代码添加方式:(摘自网路上的)
点击这里

3.运行app
1.> 横屏时

横屏
2.>竖屏时
竖屏

相关文章

  • 【UIKit】UIStackView

    UIStackView UIStackView : UIViewiOS 9.0 基于 Flexbox 思想的布局方...

  • iOS9 新特新介绍

    一. UIStackView 新控件:UIStackView 栈视图, 类似AppleWatch的Group 父类...

  • StackView

    我的博客, 各位看官有时间赏光 UIStackView UIStackView介绍 随着autolayout的推广...

  • UIStackView的应用

    UIStackView的定义 UIStackView控件有两种,横向布局和纵向布局 Axis:设置UIStackV...

  • UIStackView 初探(译)

    UIStackView 用于在列或行中布局视图集合的线性接口。 UIStackView 概览 UIStackVie...

  • UIStackView的妙用

    UIStackView简介 UIStackView是iOS 9+支持的布局控件,主要用于线性布局,可以简化布局,减...

  • iOS9新特性UIStackView

    概述 UIStackView是iOS9中新增的API,类似于Android中的线性布局。UIStackView提供...

  • UIStackView简单理解和使用

    一、UIStackView简介 UIStackView是iOS9中新增的API,类似于Android中的线性布局。...

  • iOS UIStackView

    简介 UIStackView是iOS 9 的新增控件,唯一的作用就是帮助布局 本文会详细介绍UIStackView...

  • UIStackView学习笔记

    UIStackView UIStackView能够利用,创建能够动态适应设备方向、屏幕大小和可用空间中任何更改的用...

网友评论

      本文标题:UIStackView

      本文链接:https://www.haomeiwen.com/subject/gklooxtx.html