在图形绘制中,我们经常会需要绘制文本,但我在给PDF上绘制Text时,始终绘制不上,
使用过:
[str drawInRect:cubeRect withAttributes:attrs];
CGContextShowTextAtPoint(ctx, 100.0, 100.0, "SOME TEXT", 9);
。。。。。等等,
结果,都不能显示,令我郁闷了一段时间。。。
最总找到了问题所在:
UIGraphicsPushContext(ctx);
[word drawAtPoint:CGPointMake(30.0f, 30.0f)
forWidth:200.0f
withFont:[UIFont boldSystemFontOfSize:32]
lineBreakMode:UILineBreakModeClip];
UIGraphicsPopContext();
解决问题来源:http://tiku.io/questions/1391459/ios-draw-nsstring-and-border-on-uiimage
感谢:answered 2011-10-18 19:37:36 2#
http://stackoverflow.com/questions/2209734/add-text-to-calayer