Created
October 7, 2013 16:11
-
-
Save odrobnik/6870496 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (id)initWithFrame:(CGRect)frame attributedString:(NSAttributedString *)attributedString | |
{ | |
self = [super init]; | |
if (self) | |
{ | |
_synchQueue = dispatch_queue_create("DTMutableCoreTextLayoutFrame Sync Queue", DISPATCH_QUEUE_CONCURRENT); | |
} | |
return self; | |
} | |
- (void)dealloc | |
{ | |
#if !OS_OBJECT_USE_OBJC | |
dispatch_release(_synchQueue); | |
#endif | |
} | |
- (void)drawInContext:(CGContextRef)context options:(DTCoreTextLayoutFrameDrawingOptions)options | |
{ | |
dispatch_sync(_synchQueue, ^{ | |
[super drawInContext:context options:options]; | |
}); | |
} | |
- (void)replaceTextInRange:(NSRange)range withText:(NSAttributedString *)text dirtyRect:(CGRect *)dirtyRect | |
{ | |
dispatch_barrier_sync(_synchQueue, ^{ | |
// updates | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment