2011-04-15 57 views
3

iOS API没有提到CoreText API的线程限制。在调用不使用CGContextRef的函数时,它们在非主线程上安全使用的程度如何?使用在非主线程中不使用CGContextRef的iOS CoreText API

具体来说,我试图创建一堆NSAttributedStrings使用自定义截断算法,我想能够背景的工作。我只使用:

CTLineCreateWithAttributedString 
CTLineGetTypographicBounds 
CTLineGetStringIndexForPosition 

回答

3

我应该检查<CoreText/CoreText.h>

/*! 
    @header 

    Thread Safety Information 

    All functions in this header are thread safe unless otherwise specified. 
*/ 
2

“多核考虑因素:核心文本中的所有单个函数都是线程安全的。字体对象(CTFont,CTFontDescriptor和关联的对象)可以同时被多个操作,工作队列或线程使用。然而,布局对象(CTTypesetter,CTFramesetter,CTRun,CTLine,CTFrame,和相关联的对象)应在一个单一的操作中,工作队列,或螺纹从https://developer.apple.com/library/mac/#documentation/Carbon/Reference/CoreText_Framework_Ref/_index.html

使用。”

相关问题