如何使用 CSS 在 NSAttributedString 中的 HTML 文本内制作图像叠加

问题描述 投票:0回答:1
html css ios swift nsattributedstring
1个回答
0
投票

看起来这无法通过

UITextView
和CSS来实现,因为
UITextView
不支持所需的属性。我看到至少有两种解决方案。

1:使用

WKWebView
代替
UITextView

2:使用

enumerateAttributes(in:options:using:)
方法。获取属性列表,在其中找到所需的图像并替换它。您可以使用
UIImageView
创建带有叠加层的图像,然后使用
UIImage
将其转换为
UIGraphicsImageRenderer

© www.soinside.com 2019 - 2024. All rights reserved.