Posted By

zamza726 on 03/15/11


Tagged

CGSize CALayer


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

terababy
Tintenklecks
cnathan


DrawText in CALayer


 / Published in: Objective C
 

Used in MyTTable

  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  

You need to login to post a comment.