1

データベースから取得した UIImage に緑色のテキストを追加するだけですが、どのように行われますか? これが私がこれまでに持っているものです。確かに何かが欠けています:

UIImage *img=[UIImage imageWithData:data];
    UIGraphicsBeginImageContext(CGSizeMake(360, 270));
   CGImageRef imageCon=[img CGImage];
    CGContextRef context = UIGraphicsGetCurrentContext();

    CGContextSelectFont(context, "Helvetica", 12, NSMacOSRomanStringEncoding);
    CGContextSetTextDrawingMode(context, kCGTextFill);
    CGContextSetFillColor(context, CGColorGetComponents([[UIColor whiteColor] CGColor]));
    CGAffineTransform xform = CGAffineTransformMake( 1.0, 0.0, 0.0, -1.0, 0.0, 0.0);
    CGContextSetTextMatrix(context, xform);
    CGContextShowTextAtPoint(context, 100.0f, 180.0f, "test", strlen("test"));
    UIImage *imgToAdd=[UIImage imageWithCGImage:CGBitmapContextCreateImage(context)];

    [arr addObject:imgToAdd];
4

0 に答える 0