[英]How to reduce the quality of the text inside UITextView with Swift
我正在尝试在发送消息之前降低消息的质量,例如,如果连接不佳,我想模糊UITextView
的文本,如果连接改善或互联网恢复,则删除模糊并显示正常UITextView
文本。 我试过使用CATextLayer
不起作用。 有没有办法实现这一目标?
cell.messageTextView.text = theText
let textLayer = CATextLayer()
textLayer.string = cell.messageTextView.text
textLayer.contentsScale = 0.2
cell.messageTextView.layer.addSublayer(textLayer)
你可以尝试这样的事情:
let blurEffect = UIBlurEffect(style: .systemUltraThinMaterial)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = cell.view.bounds
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
cell.view.addSubview(blurEffectView)
在表格视图单元格的顶部添加具有模糊效果的 UIVisualEffectView。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.