VCSticker
VCSticker 用来添加文本或图片覆盖层,可以使用单指缩放和旋转。
预览
安装
Cocoapods
将以下行添加到 Podfile 中
pod 'VCSticker'
然后,运行以下命令
$ pod install
手动
只需将 'VCSticker' 文件夹拖入您的 Xcode 项目。
需求
- iOS 12.0+
- Swift 5.0
使用
VCLabelSticker会根据内容文本自动改变其边界,因此您只需在代码中指定其中心位置。
let label = VCLabelSticker(center: self.view.center)
sticker.text = "666"
self.view.addSubview(label)
VCImageSticker
let image = VCImageSticker(frame: CGRect(x: 20, y: 40, width: 200, height: 200))
image.imageView.image = UIImage(named: "test")
self.view.addSubview(image)
其他变量
sticker.textColor = UIColor.red // text color
sticker.borderColor = UIColor.red // border color
sticker.closeBtnEnable = true // show close button or not
sticker.resizeBtnEnable = true // show resize button or not
sticker.restrictionEnable = true // resticts movements in superview bounds or not
sticker.onBeginEditing = {
// block when the label is activated
}
sticker.finishEditing() // deactivate the label when necessary
作者
- Github: @Vincent
VCSticker在我的个人项目'V马甲'中被使用,它是一个方便的工具程序,适用于开发者在AppStore中创建截图,试试它,也许你会喜欢它
许可证
VCSticker 在MIT许可证下可用。有关更多信息,请参阅LICENSE文件。