Quart2D文字图像绘制

本篇博客将深入探讨iOS开发与React Native技术的应用,包括如何使用Swift和Objective-C进行iOS应用开发,以及如何利用React Native快速构建跨平台移动应用。

上一个是绘制简单图形,这一篇学习绘制文字、图像

 //获取画布
    CGContextRef context=UIGraphicsGetCurrentContext();
   //设置边框颜色
    CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor);
    //文字绘制  两种绘制方法
    NSString *text=@"我是崔彦威";
    NSDictionary *dic=@{NSFontAttributeName:[UIFont systemFontOfSize:20],NSForegroundColorAttributeName:[UIColor redColor]};
    [text drawInRect:CGRectMake(0, 0, 200, 20) withAttributes:dic];
    [text drawAtPoint:CGPointMake(200, 0) withAttributes:dic];
    
    //图片绘制
    UIImage *img=[UIImage imageNamed:@"img.jpg"];
    //在矩形中绘制
//    [img drawInRect:CGRectMake(20, 20, 120, 120)];
    //以点开始绘制
//    [img drawAtPoint:CGPointMake(20, 20)];
    //平铺绘图
    [img drawAsPatternInRect:CGRectMake(20, 20, 240, 300)];

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值