修改button创建的类型为custom
在开发过程中,有一些常用扩展每次都会用到,每次拷贝来拷贝去,有点烦了,就封装成了一个工具库,使用pod来管理,方便多了。LJTool主要分成三大块:
在Podfile加入
Podfile
pod 'LJTool'
然后执行下面命令即可
pod install
1. UIColor 类 根据RGB创建UIColor
UIColor.lj.color(r: 10, g: 10, b: 10)
根据16进制创建UIColor
UIColor.lj.color(0x123456, alpha: 1)
一些常用颜色的用法,查看LJColorViewController文件
LJColorViewController
2. UI Create 可看demo中LJTool_UICreateViewController中的用法,创建完后默认会有占位符。
LJTool_UICreateViewController
fileprivate lazy var tableView: UITableView = { let tableView: UITableView = UITableView.lj.tableView(dataSource: self, delegate: self) tableView.backgroundColor = UIColor.lj.background tableView.register(LJTableViewCell.self, forCellReuseIdentifier: kLJTableViewCell) return tableView }()
fileprivate lazy var imageCollectionView: UICollectionView = { let layout = UICollectionViewFlowLayout() let collection = UICollectionView.lj.collectionView(layout: layout, dataSource: self, delegate: self) collection.register(LJCollectionViewCell.self, forCellWithReuseIdentifier: kLJCollectionViewCell) return collection }()
fileprivate lazy var userNameLabel: UILabel = { let label = UILabel.lj.label(textColor: UIColor.lj.text, fontStyle: UIFontTextStyle.headline) return label }()
fileprivate lazy var logoImageView: UIImageView = { let imageView = UIImageView.lj.imageView() return imageView }()
fileprivate lazy var commentButton: UIButton = { let button = UIButton.lj.button(title: "20", titleColor: UIColor.lj.gray999, fontSize: 14, image: #imageLiteral(resourceName: "icon_评论")) return button }()
fileprivate lazy var textField: UITextField = { let textField: UITextField = UITextField.lj.textField(placeholder: "placeholder", leftView: nil, rightView: nil) return textField }()
创建图片 创建图片主要有两个方法,一个是根据颜色值创建图片,一个是创建二维码图片
let QRImage = UIImage.lj.QRImage("test") let colorImage = UIImage.lj.image(with: UIColor.red)
UIButton 内容排列
commentButton.lj.alignImageRightTitleLeft() collectionButton.lj.alignImageUpTitleDown()
正则匹配
string.lj.matchingRegExp("^\+?(?:[1-9]\d*(?:\.\d{1,2})?|0\.(?:\d[1-9]|[1-9]\d))quot;)
有好的建议或者反馈可发Issues
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
LJTool
LJTool简介
在开发过程中,有一些常用扩展每次都会用到,每次拷贝来拷贝去,有点烦了,就封装成了一个工具库,使用pod来管理,方便多了。LJTool主要分成三大块:
安装
在
Podfile
加入然后执行下面命令即可
基本使用
1. UIColor 类 根据RGB创建UIColor
根据16进制创建UIColor
一些常用颜色的用法,查看
LJColorViewController
文件2. UI Create 可看demo中
LJTool_UICreateViewController
中的用法,创建完后默认会有占位符。创建图片 创建图片主要有两个方法,一个是根据颜色值创建图片,一个是创建二维码图片
UIButton 内容排列
正则匹配
联系我
有好的建议或者反馈可发Issues