UITextView 上的 CGAffineTransformMakeScale

发布于 2025-01-06 08:50:23 字数 195 浏览 3 评论 0原文

我有一个 UITextView 的实例。它实际上是一个盒子,当用户点击它时,我想让它变大。所以我在点击事件中实现了CGAffineTransformMakeScale。

问题是,UITextView 内的文本变得模糊。我设置了 contentMode = UIViewContentModeRedraw,但没有影响它。

有什么想法吗?非常感谢。

I have an instance of UITextView. It is actually a box, and when user taps on it, I want to make it bigger. So I implemented CGAffineTransformMakeScale in tap event.

The problem is, the text inside the UITextView gets fuzzy and blurry. I set contentMode = UIViewContentModeRedraw, but didn't affect it.

Any idea? Many thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

错爱 2025-01-13 08:50:23

这总是会发生的。如果您使用变换来缩放它,它总是会变得模糊,因为整个文本视图都被缩放,包括所有内容。

防止这种情况的唯一方法是不使用变换比例,而只是使文本视图框架更大!

This is always going to happen. If you scale it like that using the transform it will always get blurry because the whole textview is scaled, including all contents.

The only way to prevent this is not using the transform scale but simply make the textview frame bigger!

如梦初醒的夏天 2025-01-13 08:50:23

您可以在点击放大字体后尝试重置文本吗?

NSString *placeholderText = textView.text;
textView.font = // bigger font proportional to scaling

textView.text = placeholderText;

Can you try to reset the text after making the font bigger on the tap?

say

NSString *placeholderText = textView.text;
textView.font = // bigger font proportional to scaling

textView.text = placeholderText;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文