UIScrollView 内的核心文本段落模糊

发布于 2024-12-09 19:08:07 字数 201 浏览 1 评论 0原文

我尝试在 UIScrollView 内的视图中绘制一个长段落作为 NSAttributedString 。奇怪的是,段落的顶部并不模糊,但我滚动到底部越多,它就越模糊!我很清楚 Quartz 和 float 可能会遇到的小问题,因此我尝试将视图的框架设置为低于 0.5 点。现在我的段落顶部很模糊,底部还可以(!)我真的不知道如何解决这个问题,非常感谢任何帮助!

谢谢 !

I tried drawing a long paragraph as an NSAttributedString in a view inside a UIScrollView. Weird thing is, the top of the paragraph is not blurry, but the more I scroll to the bottom the blurrier it gets ! I am well aware of the small issues you can have with Quartz and floats, therefore I tried to set the frame of the view 0.5 points below. Now the top of my paragraph is blurry, and the bottom is OK (!) I really don't know how to fix this, and would appreciate any help !

Thank you !

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

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

发布评论

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

评论(1

淡紫姑娘! 2024-12-16 19:08:07

我遇到的模糊文本的每个问题始终与将文本定位在子像素偏移处有关。在某个地方,您的位置可能不是整数,您应该将其向上或向下舍入。您可能想要检查的地方:

  • UIScrollView 的位置
  • 滚动视图的 contentOffset
  • 中覆盖 drawRect 的视图的位置
  • 您在实际的 rect(路径) 吸引你的 CoreText 调用

我意识到这个问题已经有几个月了,但是无论如何得到一个答案都会很有用!

Every problem I've had to do with blurry text has always been to do with positioning the text at a sub-pixel offset. Somewhere, you probably have a position that isn't a whole number, and you should round it up or down. Places you might want to check:

  • The position of your UIScrollView
  • The contentOffset of your scroll view
  • The position of the view that you override drawRect in
  • The rect (path) that you actually draw into for your CoreText calls

I realise that this question is a few months old, but though it would be useful to have an answer anyway!

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