RGButton
使用Swift编写的CocoaPods库
使用RGButton创建您自己动态设计的按钮。
预览
使用界面构建器创建可定制的按钮,就像这样:
安装
使用CocoaPods将RGButton集成到您的Xcode项目中
use_frameworks!
pod 'RGButton', '1.0.3'
用法
将UIView
对象拖放到您的视图控制器中,并将其类和模块设置为RGButton
。
通过在您的UIButton中添加子视图来自定义您的按钮。
将IBOutlet
连接到您的ViewController
类。
可调整项
属性 | 描述 | 默认值 |
---|---|---|
animates |
触摸动画 | true |
circular |
设置圆角半径为按钮高度的一半。如果设置为true,则忽略cornerRadius |
false |
cornerRadius |
固定的圆角半径 | 0.0 |
topLeft |
是否在视图的左上角应用圆角半径 | true |
topRight |
是否在视图的右上角应用圆角半径 | true |
bottomLeft |
是否在视图的左下角应用圆角半径 | true |
bottomRight |
是否在视图的右下角应用圆角半径 | true |
borderWidth |
边框宽度 | 0.0 |
borderColor |
边框颜色 | clear |
shadowColor |
阴影颜色 | clear |
shadowRadius |
阴影半径 | 0.0 |
shadowOpacity |
阴影透明度 | 0.0 |
shadowOffset |
阴影偏移 | width: 0.0, height: -1.0 |
titleLabelColor |
文本颜色为视图层次结构中第一个UILabel 子视图 |
黑色 |
imageTintColor |
视图层次结构中第一个&)& | 黑色 |
firstColor |
渐变中的第一种颜色 | clear |
middleColor |
渐变中的中间颜色 | clear |
lastColor |
渐变中的最后一种颜色 | clear |
isHorizontal |
渐变是否为水平方向 | true |
其他属性
属性 | 描述 |
---|---|
titleLabels |
返回视图层次结构中的所有直接UILabel 子视图 |
titleLabel |
返回视图层次结构中的第一个直接UILabel 子视图 |
imageViews |
返回视图层次结构中的所有直接UIImageView 子视图 |
imageView |
返回视图层次结构中的第一个直接UIImageView 子视图 |
问题
欢迎提交问题和功能请求。
作者
Reniel Galerio
许可证
MIT License
Copyright (c) 2021 Reniel Galerio
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.