如何将图像和一些文本覆盖到UIImage上?

问题描述

| 我正在尝试将签名图像以及一些文本覆盖到传真图像上。 到目前为止,我有以下代码
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。我该怎么做?我真的很困惑。     

解决方法

        在
NSString(UIStringDrawing)
中检出
– drawAtPoint:withFont:
,这样的一些代码应该可以工作:
[@\"My Signature\" drawAtPoint:somePoint withFont:[UIFont fontWithName:@\"Arial\" size:10.0]];