且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

CGContext文本绘图无法在iPhone 4上扩展

更新时间:2023-11-09 22:55:52

你应该设置图层的 contentsScale 与屏幕的比例相同:

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

layer.contentsScale = [UIScreen mainScreen].scale;

这将在所有iOS设备,Retina Display和非Retina Display上正确缩放。除非你有充分的理由这样做,否则你不应该硬编码为2.0(或其他任何事情)。

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.