开发者

Core Text paragraph inside a UIScrollView is blurry

开发者 https://www.devze.com 2023-04-12 23:28 出处:网络
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 g

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 y开发者_运维知识库ou !


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号