[英]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.