DJCaptureButton
带有 3D 触摸功能的相机样式的捕获按钮。
示例
要运行示例项目,先克隆仓库,然后在示例目录中运行 pod install
。
要求
iOS 10.0
安装
DJCaptureButton 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中:
pod 'DJCaptureButton'
用法
用户手册
let captureButton = DJCaptureButton(frame: .init(x: 0, y: 0, width: 60, height: 60))
captureButton.delegate = self
view.addSubview(captureButton)
添加代理
extension ViewController: DJCaptureButtonDelegate {
func captureButtonDidFire(captureButton: DJCaptureButton) {
debugPrint("Capture button action")
}
}
自定义
captureButton.borderWidth = 4
captureButton.borderColor = .yellow
captureButton.middleCircleOffset = 4
captureButton.middleCircleColor = .blue
界面构建器
- 在界面构建器中添加一个UIButton。
- 将“class”属性设置为DJCaptureButton。
- 连接代理。
请参阅示例项目。
自定义
更多属性在“属性检查器”中可用。
结果
作者
David Jonsén
许可证
DJCaptureButton 在 MIT 许可下可用。请参阅 LICENSE 文件以获取更多信息。