首页 > 其他 > 详细

绘画字符串

时间:2014-02-15 03:22:53      阅读:359      评论:0      收藏:0      [点我收藏+]

  CGContextRef context = UIGraphicsGetCurrentContext();//获取绘画上下文

    

    UIColor *color = [UIColorcolorWithRed:0.8green:0.2blue:0.3alpha:0.9];

    

    CGColorRef aCGColor = color.CGColor;//设置绘画颜色

    

    CGContextSetFillColor(context, CGColorGetComponents(aCGColor));//绘画的填充颜色

    

    CGContextSetFlatness(context, 1);//设置绘画平整度

    

    CGContextSetFontSize(context, 20.0f);//设置大小

    

    CGContextSetCharacterSpacing(context, 5.0f);//设置字符之间的间距

   

    CGContextFillRect(context, CGRectMake(0.0f, 0.0f, 320.0f, 480.0f));//填充的区域大小

  

    CGContextSetStrokeColor(context, CGColorGetComponents([UIColoryellowColor].CGColor));//设置线框的颜色

 

    NSString *str = @"HELLO";

    

    NSMutableAttributedString *str0 = [[NSMutableAttributedStringalloc ]initWithString:str];

    

    

    [str0 drawWithRect:CGRectMake(100.0f, 200.0f, 100.0f, 30.0f) options:NSStringDrawingUsesDeviceMetricscontext:nil];//字符串自己的放法进行绘画

绘画字符串

原文:http://www.cnblogs.com/leevaboo/p/3549499.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!