I have subclassed an UILabel and i use drawrect method to draw the string on the screen. This is my code:
- (void)drawRect:(CGRect)rect
{
CGRect aRect = self.frame;
NSMutableArray *Text=[globaltextarray Text];
[[NSString stringWithCString:[[Text objectAtIndex:labelindexpath.row] cStringUsingEncoding:NSISOLatin1StringEncoding] encoding:NSUTF8StringEncoding] drawInRect:aRect
withFont:[UIFont fontWithName:@"Times New Roman" size:15.0] lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentLeft];
[super drawRect:rect];
}
It is working fine but it is slow for my purpose. I need to draw the string without using [Label setNeedDisplay];
because setNeedsDisplay needs to be called from the main thread. The rendering work needs to be done in a background queue. I would be grateful if you could provide me with a small example. Any help appreciated.
Thanks.