参考:https://developer.apple.com/library/ios/documentation/UIKit/Reference/NSAttributedString_UIKit_Additions/index.html#//apple_ref/c/tdef/NSStringDrawingOptions
The UIKit framework adds methods to NSAttributedString
to support the drawing of styled strings and to compute the size and metrics of a string prior to drawing. None of these methods affects the contents of the object itself, only how it is drawn on screen.
UIKit框架增加了方法NSAttributedString支持风格的字符串的绘制和计算之前绘制一个字符串的大小和度量.这些方法没有影响对象本身,它是仅绘制方式在屏幕上的内容。(只有他是在屏幕上如何绘制的)
By default, strings are drawn using the native coordinate system of iOS, where content is drawn down and to the right from the specified origin point. Whenever you are positioning string content, you should keep this orientation in mind and use the upper-left corner of the string’s bounding box as the origin point for drawing.
默认情况下,字符串使用iOS本地坐标系统来绘制,其中内容被下拉并且在指定原点右边的本地坐标系开始绘制.当你定位的字符串的内容,你应该保持这个方向考虑,使用字符串的边框的左上角为原点进行绘制
You may use the methods described in this class extension from secondary threads in your app and not just from the main thread. However, if you use any of the methods that support an NSStringDrawingContext
object, you must not share contexts across threads or dispatch queues.