2011-04-15 23 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

使用。」

相關問題