码迷,mamicode.com
首页 > 其他好文 > 详细

利用Quartz2D-contex绘制文本

时间:2015-08-29 09:39:17      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:

//获取上下文
  CGContextRef context =UIGraphicsGetCurrentContext();
    //线条加粗
    CGContextSetLineWidth(context , 5);
 
CGContextSetLineWidth(context, 5);
    CGRect rect =CGContextGetClipBoundingBox(context);
    //填充颜色
    CGContextSetFillColorWithColor(context, [[UIColor whiteColor]CGColor]);
    CGContextFillRect(context, rect);
    CGContextSetAllowsAntialiasing(context, YES);
    //填充颜色
    CGContextSetFillColorWithColor(context, [[UIColor brownColor]CGColor]);
    NSString *str =@"小黑是小狗";
    [str drawInRect:CGRectMake(100, 100, 100, 100) withFont:[UIFont systemFontOfSize:30.0]];

    CGContextSetTextMatrix(context, CGAffineTransformScale(CGAffineTransformIdentity, 1, -1));
    //填充颜色
    CGContextSetStrokeColorWithColor(context, [[UIColor whiteColor]CGColor]);
    CGContextStrokeRect(context, CGRectMake(100, 100, 100, 100));
        CGContextStrokeRect(context, CGRectMake(100, 100, 100, 100));
    CGContextStrokePath(context);
   

利用Quartz2D-contex绘制文本

标签:

原文地址:http://www.cnblogs.com/yxt9322yxt/p/4768329.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!