KGNAutoLayout 1.8.3

KGNAutoLayout 1.8.3

测试已测试
Lang语言 SwiftSwift
许可协议 MIT
发布最新版本2020年7月
SPM支持 SPM

David Keegan 维护。



  • David Keegan

KGNAutoLayout

KGNAutoLayoutAutoLayout 变得简单易用!

Swift 3 Release License

Build Status Test Coverage Carthage Compatible CocoaPods Version CocoaPods Platforms

Twitter Follow Star

安装

Carthage

github "kgn/KGNAutoLayout"

CocoaPods

pod 'KGNAutoLayout'

示例

示例应用

Example App

固定:上视图

view.pinToEdgesOfSuperview(withOffset: 20)

pinToEdgesOfSuperview_offset20

view.pinToTopEdgeOfSuperview(withOffset: 20)

pinToTopEdgeOfSuperview_offset20

view.pinToRightEdgeOfSuperview(withOffset: 20)

pinToRightEdgeOfSuperview_offset20

view.pinToBottomEdgeOfSuperview(withOffset: 20)

pinToBottomEdgeOfSuperview_offset20

view.pinToLeftEdgeOfSuperview(withOffset: 20)

pinToLeftEdgeOfSuperview_offset20

view.pinToSideEdgesOfSuperview(withOffset: 20)

pinToSideEdgesOfSuperview_offset20

view.pinToTopAndBottomEdgesOfSuperview(withOffset: 20)

pinToTopAndBottomEdgesOfSuperview_offset20

固定:边缘

view.pinTopEdgeToTopEdge(of: itemView, withOffset: 20)

pinTopEdgeToTopEdgeOfItem_offset20

view.pinRightEdgeToRightEdge(of: itemView, withOffset: 20)

pinRightEdgeToRightEdgeOfItem_offset20

view.pinBottomEdgeToBottomEdge(of: itemView, withOffset: 20)

pinBottomEdgeToBottomEdgeOfItem_offset20

view.pinLeftEdgeToLeftEdge(of: itemView, withOffset: 20)

pinLeftEdgeToLeftEdgeOfItem_offset20

中心

view.centerInSuperview()

centerInSuperview

view.centerHorizontallyInSuperview()

centerHorizontallyInSuperview

view.centerVerticallyInSuperview()

centerVerticallyInSuperview

[view1, view2, view3].centerHorizontally(to: parentView, withSeparation: 20)

centerViewsHorizontally_separation20

[view1, view2, view3].centerVertically(to: parentView, withSeparation: 20)

centerViewsVertically_separation20

view.centerHorizontally(to: itemView)

centerHorizontallyToItem

view.centerVertically(to: itemView)

centerVerticallyToItem

大小

view.size(toWidth: 80)

sizeToWidth80

view.size(toMinWidth: 40)

sizeToMinWidth40

view.size(toMaxWidth: 100)

sizeToMaxWidth100

view.size(toHeight: 80)

sizeToHeight80

view.size(toMinHeight: 40)

sizeToMinHeight40

view.size(toMaxHeight: 100)

sizeToMaxHeight100

view.size(toWidthAndHeight: 80)

sizeToWidthAndHeight80

view.size(toMinWidthAndHeight: 40)

sizeToMinWidthAndHeight40

view.size(toMaxWidthAndHeight: 100)

sizeToMaxWidthAndHeight100

view.sizeWidthToWidth(of: itemView)

sizeWidthToWidthOfItem

view.sizeHeightToHeight(of: itemView)

sizeHeightToHeightOfItem

view.sizeHeightToWidth(of: itemView)

sizeHeightToWidthOfItem

view.sizeWidthToHeight(of: itemView)

sizeWidthToHeightOfItem

view.sizeWidthAndHeightToWidthAndHeight(of: itemView)

sizeWidthAndHeightToWidthAndHeightOfItem

view.sizeHeightToWidth(withAspectRatio: 16/9)

sizeHeightToWidthAspectRatio16by9

view.sizeWidthToHeight(withAspectRatio: 16/9)

sizeWidthToHeightAspectRatio16by9

位置

view.positionAbove(itemView, withOffset: 20)

positionAboveItem_offset20

view.positionToTheRight(of: itemView, withOffset: 20)

positionToTheRightOfItem_offset20

view.positionBelow(itemView, withOffset: 20)

positionBelowItem_offset20

view.positionToTheLeft(of: itemView, withOffset: 20)

positionToTheLeftOfItem_offset20

[view1, view2, view3].positionAbove(itemView, withOffset: 20)

positionViewsAbove_offset20

[view1, view2, view3].positionToTheRight(of: itemView, withOffset: 20)

positionViewsToTheRight_offset20

[view1, view2, view3].positionBelow(itemView, withOffset: 20)

positionViewsBelow_offset20

[view1, view2, view3].positionToTheLeft(of: itemView, withOffset: 20)

positionViewsToTheLeft_offset20

之间

view.fitBetween(top: topView, andBottom: bottomView, withOffset: 20)

fitBetweenTopAndBottomItems_offset20

view.fitBetween(left: leftView, andRight: rightView, withOffset: 20)

fitBetweenLeftAndRightItems_offset20

填充

parentView.fillHorizontally(withViews: [view1, view2, view3], separation: 20)

fillHorizontally_separation20

parentView.fillVertically(withViews: [view1, view2, view3], separation: 20)

fillVertically_separation20

边界

itemView.boundHorizontally(withViews: [view1, view2, view3], separation: 20)

boundHorizontally_separation20

itemView.boundVertically(withViews: [view1, view2, view3], separation: 20)

boundVertically_separation20

itemView.boundVertically(withViews: [view1, view2, view3], separation: 20)

boundVertically_separation20

进度

  • Travis
  • 徽章
  • 测试
  • Carthage
  • CocoaPods
  • 描述
  • 文档
  • 示例应用
  • AppleTV
  • 预构建框架
  • Travis测试矩阵