//获取上下文
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);
//填充颜色
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);