HKUIViewUtilities 1.0.0

HKUIViewUtilities 1.0.0

Harrison Kong 维护。



  • 作者
  • Harrison Kong

HKUIViewUtilities

UIView HK Utilities 方法扩展

概要

此模块扩展了 UIView,并提供了实用方法。这是许多其他 Swift HK 模块所必需的模块。

可用的公共实用方法

所有方法都可以由任何继承自 UIView 的类调用。公开方法可以在项目的任何代码中调用。

public final func contentMinBox() -> CGSize

返回可以容纳所有子视图的最小框尺寸。

public final func isLandscape() ->.Bool

如果宽度 > 高度,则返回 true。否则,返回 false。

public final func isPortrait() -> Bool

如果宽度 <= 高度,则返回 true。否则,返回 false。

public final func longerEdgeLength() -> CGFloat

如果宽度 > 高度,则返回宽度。否则,返回高度。

public final func shorterEdgeLength() -> CGFloat

如果宽度 <= 高度,则返回高度。否则,返回宽度。

安装

这将被其他 HK 模块或 CocoaPod 自动包含。

在您的项目中使用

只需在您的项目中包含 UIView+HKUILayoutShorthands.swift 文件,或使用 CocoaPod。如果您使用 CocoaPod,别忘了导入模块。

  import HKUIViewUtilities