DrawText in CALayer


/ Published in: Objective C
Save to your folder(s)

Used in MyTTable


Copy this code and paste it in your HTML
  1. - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx {
  2. NSString * data_title = @"Sample";
  3.  
  4. UIGraphicsPushContext(ctx);
  5. .....
  6. UIFont *font = [UIFont boldSystemFontOfSize:13];
  7. CGSize titletextSize = [data_title sizeWithFont:font];
  8. textPoint.x = 0.8f * (CGRectGetWidth(layer.bounds) - titletextSize.width);
  9. CGContextDrawPath(ctx, kCGPathFill);
  10. [subject drawAtPoint:titlePoint withFont:font];
  11. UIGraphicsPopContext();
  12.  
  13. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.