CGContext text drawing doesn't scale up on iPhone 4

ⅰ亾dé卋堺 提交于 2019-12-03 07:33:22

You should set the layer's contentsScale to be the same as the scale of your screen:

layer.contentsScale = [UIScreen mainScreen].scale;

This will scale it correctly on all iOS devices, Retina Display and non-Retina Display. You shouldn't hard-code it to 2.0 (or anything else for that matter) unless you have a good reason to do so.

The link of the previous answer is broken now. New link is this one.

Jason Foreman

Since you're dealing with CALayers, you need to set the contentsScale property of your layer to 2.0.

See this section in the iPhone Application programming guide for iOS 4.

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