PDFloraButton
使用 PDFloraButton.swift 类,用最少的代码行在任意视图中添加 flora 按钮。您还可以通过发送图像字符串数组来添加周围的按钮图像。因此,您可以轻松使用。
截图
预定义位置
center, topLeft, topRight, bottomLeft, bottomRight, midTop, midBottom, midLeft, midRight
Swift 3.0 下的简易性
import UIKit
class ViewController: UIViewController {
let floraButton = PDFloraButton(withPosition: .center, size: 50.0, numberOfPetals: 20, images:[]) let floraButton2 = PDFloraButton(withPosition: .topLeft, size: 50.0, numberOfPetals: 4, images:[]) let floraButton3 = PDFloraButton(withPosition: .topRight, size: 50.0, numberOfPetals: 4, images:[]) let floraButton4 = PDFloraButton(withPosition: .bottomLeft, size: 50.0, numberOfPetals: 4, images:[]) let floraButton5 = PDFloraButton(withPosition: .bottomRight, size: 50.0, numberOfPetals: 4, images:[])
override func viewDidLoad() { super.viewDidLoad() self.view.addSubview(floraButton) self.view.addSubview(floraButton2) self.view.addSubview(floraButton3) self.view.addSubview(floraButton4) self.view.addSubview(floraButton5)
floraButton.buttonActionDidSelected = { (indexSelected) in debugPrint("选中索引: (indexSelected)") } } }
解释获取
https://medium.com/@iopriyam93/ios-coordinate-system-trigonometry-5432c05909b1
示例
要运行示例项目,请克隆仓库,然后首先从示例目录运行pod install
。
需求
安装
FloraButton 通过 CocoaPods 提供。要安装它,只需向您的 Podfile 添加以下行
pod 'FloraButton'
作者
PriyamDutta, [email protected]
许可协议
FloraButton 在 MIT 许可协议下提供。有关更多信息,请参阅 LICENSE 文件。