Core Text paragraph inside a UIScrollView is blurry

旧巷老猫 提交于 2019-12-23 03:22:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!