In order for these separate text containers to work, you calculate the size of the picture for each part of the line and limit the NSTextView to this size:
NSLayoutManager * layout = [[NSLayoutManager alloc] init]; NSString * storedString = @"A\nquick\nBrown\nFox"; NSTextStorage * storage = [[NSTextStorage alloc] initWithString:storedString]; [storage addLayoutManager:layout];
You can add a delegate to NSLayoutManager to view the use of the text container:
- (void)layoutManager:(NSLayoutManager *)aLayoutManager didCompleteLayoutForTextContainer:(NSTextContainer *)aTextContainer atEnd:(BOOL)flag { if (aTextContainer == nil) {
source share