ios - 单击并拖动 CGContext 绘图以将其放置在屏幕上的任何位置
问题描述
UIGraphicsBeginImageContext(MyImage.frame.size)
let context = UIGraphicsGetCurrentContext()
tempImage.image?.draw(in: CGRect(x: 0, y: 0, width: MyImage.frame.size.width, height: MyImage.frame.size.height))
context?.move(to: startPoint)
context?.addLine(to: point)
context?.setLineCap(.round)
context?.setLineWidth(3)
context?.setStrokeColor(UIColor.blue.cgColor)
context?.setBlendMode(.normal)
context?.strokePath()
tempImage.image = UIGraphicsGetImageFromCurrentImageContext()
tempImage.alpha = 1.0
UIGraphicsEndImageContext()
我正在使用上面的代码在图像上徒手绘制。绘制图像后,可以单击绘图上的任意位置并将其移动以将其放置在屏幕上的任意位置。
解决方案
检查这个库:https ://github.com/luiyezheng/JLStickerTextView 我认为这就是我想要的。
推荐阅读
- python-3.x - scheme.activate 返回 status1
- linux - 时间命令问题
- python - 从 Flask 返回 render_template 或 jsonify 作为 jQuery 响应
- docker - Docker 构建卡在 MariaDB 安装上
- java - CompletableFuture 的意外行为
- swift - 如何从 CollectionView 中找到图像的名称?
- kubernetes - 我们如何在 prometheus 中导出 cadvisor 指标
- javascript - VueJS如何在for循环中每行3个项目只选择一个项目?
- python - 将图从pylab转换为base64而不缓存它
- c# - 找出 Last_Insert_Id() 使用 c# 和 MySql 存储过程(在数据访问层 MVC 中)