UIScrollView中的核心文本段落模糊 [英] Core Text paragraph inside a UIScrollView is blurry
问题描述
我尝试在UIScrollView内部的视图中将较长的段落绘制为NSAttributedString。奇怪的是,该段的顶部不是模糊的,但是我越滚动到底部,它就会变得模糊!我非常了解Quartz和floats可能存在的小问题,因此我尝试将视图的框架设置为以下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 !
谢谢您!
推荐答案
与模糊文本有关的每个问题始终与将文本放置在子目录中有关-像素偏移。在某个地方,您的职位可能不是整数,应该向上或向下取整。您可能要检查的地方:
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:
-
UIScrollView
- 滚动视图的contentOffset
- 在其中覆盖
drawRect
的视图的位置 - 您为CoreText调用实际绘制的矩形(路径)
- 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!
这篇关于UIScrollView中的核心文本段落模糊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!