测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可协议 | MIT |
发布最后发布 | 2016年10月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✗ |
由 Ricard 维护。
为现有视图添加类似缎带形状的标签的库
只需将 RicRibbonLabel.swift 和 RicRibbonTag.swift 复制到您的项目中
let ribbon = RicRibbonTag()
ribbon.type = .TopLeftCorner
ribbon.label.text = "20% Discount"
ribbon.originDistance = 40
ribbon.ribbonWidth = 40
ribbon.label.textColor = UIColor.whiteColor()
ribbon.wrap(containerView)
标签在内部渲染的标签,可用于修改其文本和字体。它的 frame、origin 和 transform 在内部修改,不应进行编辑
缎带的装饰在边缘的外部的大小,禁用 clipstobounds 会在父视图中使它们可见
缎带的宽度,如果启用自动调整大小,则忽略此值
缎带将显示的颜色
缎带边缘的颜色
缎带边缘的宽度
从容器视图的参考点到缎带的最近点的距离
缎带的长度,仅适用于 .Left .Right 和 .Top 类型
如果启用,可以修改起点距离和飘带宽度,以保持飘带在容器边界内
如果启用,在需要时将按水平方向移动飘带来保持整个飘带在容器边界内
如果启用,则飘带将投射阴影
如果启用,它将在飘带的边缘显示装饰项,要使它们可见,应在父视图中禁用clipstobounds
它确定飘带在容器中的位置,允许以下值
enum RibbonType {
case TopLeftCorner
case TopRightCorner
case BottomLeftCorner
case BottomRightCorner
case Left
case Right
case Top
}
当启用自动调整大小时,在飘带及其标签之间添加的内边距
启用后,飘带宽度将与标签高度相等
用于使用当前飘带包装一个视图
设置一个虚线图案作为飘带的边距,其中lineWidth将是条纹长度,spaceWidth是条纹之间的长度
MIT License
Copyright (c) 2016 Ricard Romeo Murgó (https://github.com/ricardrm88)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.