Dezignables 3.1.0

Dezignables 3.1.0

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最后发布2017年10月
SwiftSwift 版本3.0
SPM支持 SPM

Daniel van Hoesel 维护。



  • Daniel van Hoesel

Dezignables




这是一系列我经常在我 iOS 项目中使用的设计可用组件。检查示例项目以查看所有可用选项。

示例

要运行示例项目,克隆仓库,然后首先从 Example 目录运行 carthage bootstrap --no-use-binaries --platform ios

安装

Dezignables 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod "Dezignables"

API

Dezignables 通过协议扩展实现。预制组件包括所有或大多数可用 dezignables 和芳香油,可即时使用。您也可以将一个或多个 dezignable 协议应用于自己的组件。

组件

Dezignables
DezignableView
  • DezignableBorder
  • DezignableCorner
  • DezignableRotation
  • DezignableBackground
  • DezignableShadow
DezignableButton
  • DezignableBorder
  • DezignableCorner
  • DezignableRotation
  • DezignableBackground
  • DezignableShadow
  • DezignableHighlight
DezignableImageView
  • DezignableBorder
  • DezignableCorner
  • DezignableRotation
  • DezignableBackground
  • DezignableShadow
DezignableLabel
  • DezignableBorder
  • DezignableCorner
  • DezignableRotation
  • DezignableBackground
  • DezignableShadow
DezignableTableViewController
  • 解决了与 swipe-back-gesture 的问题。当快速 swipe-back 到一个 table view controller 时,cell 的选择不会被清除。此组件解决了此问题。
  • 可用于与静态表格,由 Interface Builder 设计。
  • DezignableSeparator
  • DezignableHighlight
  • DezignableHiddenSections
DezignableViewController
  • DezignableHiddenNavigationBar
  • DezignableStatusBar

Dezignables

DezignableBorder

属性 描述 预览
borderWidth 设置边界的宽度,单位为点
borderColor 边界的颜色
borderTop 绘制顶部边界
borderBottom 绘制底部边界
borderLeft 绘制左侧边界
borderRight 绘制右侧边界
borderScaleCorrection borderWidth 转换为物理像素。 borderWidth 值除以 UIScreen.mainScreen().scale。要创建细线边界,请使用 borderWidth=1.0borderScaleCorrection=true

DezignableCorner

属性 描述 预览
cornerRadius 四个角的半径,单位为点
cornerCircle 根据视图的高度创建一个完整的圆形。当与 DezignableRotation 一起使用时,预览看起来很奇怪。

DezignableRotation

属性 描述 预览
rotation 视图应该旋转的度数

DezignableBackground

属性 描述 预览
backgroundFillColor 用纯色填充视图
backgroundGradientStartColor 渐变的起始颜色
backgroundGradientStopColor 渐变的结束颜色
backgroundGradientStartPoint 起始颜色的位置
背景渐变停止点 渐变中停止颜色的位置

DezignableShadow

当你想同时使用 DezignableShadowDezignableBorder 时,你需要使用两个不同的视图并将它们精确地叠加在一起。请参见示例应用程序以获取演示。

属性 描述 预览
boxShadowColor 阴影的颜色
boxShadowRadius 阴影将扩散多远
boxShadowOpacity 阴影的透明度。0.0是完全不可见的,1.0是完全可见的
boxShadowOffset 阴影绘制起始点

DezignableSeparator

这是一个表格单元格分隔符,当选中单元格时不会消失。单元格需要是 DezignableTableViewCell 的子类,或者可以直接使用 DezignableTableViewCell

属性 描述 预览
separatorColor 分隔符的颜色
separatorWidth 分隔符的宽度,以点为单位
separatorScaleCorrection separatorWidth 转换为物理像素。将 separatorWidth 的值除以 UIScreen.mainScreen().scale。要创建发丝边框,请使用 separatorWidth=1.0borderScaleCorrection=true

DezignableHiddenSections

这些函数可以从 DezignableTableViewController 的子类或直接在控制器上调用。

函数 描述 预览
hideSection(section: Int) 隐藏指定的部分(部分索引从0开始)
showSection(section: Int) 显示指定的部分(部分索引从0开始)
isSectionHidden(section: Int) -> Bool 当给定部分隐藏时返回 true(部分索引从0开始)

DezignableHighlight

为表格单元格和按钮提供自定义高亮和选择背景颜色。单元格需要是 DezignableTableViewCell 的子类,或者可以直接使用 DezignableTableViewCell

属性 描述 预览
selectedBackgroundColor 选择单元格时使用的颜色 单元格- 按钮
highlightBackgroundColor 高亮单元格时使用的颜色。对于单元格,如果此值为 ,则使用 selectedBackgroundColor 单元格- 按钮
normalBackgroundColor 单元格的默认背景颜色,默认为 UIColor.whiteColor() 单元格- 按钮

DezignableHiddenNavigationBar

属性 描述 预览
navigationBarHidden 是否为该视图控制器隐藏导航栏

DezignableStatusBar

属性 描述 预览
statusBarLight 为该视图控制器显示浅色状态栏
statusBarHidden 是否为该视图控制器隐藏状态栏

许可证

Dezignables 可在 MIT 许可证下使用。有关更多信息,请参见 LICENSE 文件。