问题
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 !
回答1:
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!
来源:https://stackoverflow.com/questions/7754665/core-text-paragraph-inside-a-uiscrollview-is-blurry