CGMutablePathRef path = CGPathCreateMutable();CGPathAddRect(path,NULL,self.bounds);
NSAttributedString *string = [NSAttributedString alloc]initWithString:@"Hello Core Text"];
CTFrameSetterRef frameSetter = CTFramesetterCreateWithAttributesString((CFAttributedStringRef)string); CTFrameRef frame = CTFramesetterCreateFrame(framesetter,CFRangeMake(0,[string length]),path,NULL);
CTFrameDraw()
Text Wrapping around figures and shapes (Exclusion Paths)
Text Folding :
mechanism to a hide and reveal blocks of text
Mary had a little lamb with fleece as white as snow.
Mary had.......with.........as snow.
Rich Text Editing :
Interactive Text Colouring - changes the attributes of the text when the user types the text.
All techniques work in standard components.
UITextView and UITextField supports all text attributes. Kerning and Ligatures everywhere by default. Letterpress text effect.
Hit Testing :
Resolving tap to a character index.
Interaction with Links :
new in iOS7,we can turn any arbitrary text range into Links using NSLinkAttributeName. Long Press on it opens the action sheet (default behaviour of iOS7)
Data Detectors :
detects a particular data and performs action.
Text Attachments :
used for inline images
Affects and affected by text layouts.
contains geometry for contained data.
are interactable.
NSTextStorage : defines the fundamental storage mechanism for text. implements change management, verification of attributes, delegate handling and layout management.
NSTextContainer : defines the region where text is to be laid out.
NSLayoutManager : coordinates the layout and display of characters.Maps Unicode characters to glyphs and sets them in NSTextContainer objects and display them in the series of textview objects.
NSTextStorage *textStorage = [NSTextStorage alloc]initWithString:@"Hello Core Text"];
NSTextLayoutManager *layoutManager = [NSTextLayoutManager alloc]init];
[textStorage addLayoutManager: layoutManager];
NSTextContainer = [[NSTextContainer alloc]initWithSize:CGSizeMake(width,height)];
[layoutManager addTextContainer:textContainer];[self.view addsubView:textView];
UITextView *textView = [UITextView alloc]initWithFrame:CGRectMake() textContainer:textContainer]; [self.view addSubView:textView];