如何将图像和一些文本叠加到UIImage上?

时间:2011-06-22 02:11:06

标签: iphone objective-c ios

我正在尝试将签名图像与一些文本叠加到传真图像上。 我到目前为止使用了以下代码:

CGRect faxImageRect = CGRectZero;
CGRect signatureRect = CGRectZero; //need to add a logo and some text here
//faxImage is a fax UIImage
//signature is a Logo UIImage

faxImageRect.size = faxImage.size;
signatureRect.size = signature.size;

// Adjust the signature's location within the fax image
signatureRect.origin = desirableLocation;

UIGraphicsBeginImageContext(faxImage.size);
[faxImage drawInRect:faxImageRect];
[signature drawInRect:signatureRect];
image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

我需要写一些文字作为我签名的一部分。 Arial尺寸10.我该怎么做?我真的很困惑。

1 个答案:

答案 0 :(得分:1)

结帐– drawAtPoint:withFont: NSString(UIStringDrawing),这样的代码应该有效:

[@"My Signature" drawAtPoint:somePoint withFont:[UIFont fontWithName:@"Arial" size:10.0]];