我正在生成某种格式的pdf文件,其中借助以下代码放置了一个矩形框...
CGContextRef context = UIGraphicsGetCurrentContext();
CGPathRef path = CGPathCreateWithRect(CGRectMake(40, rectPosition, 540, 150), NULL);
[[UIColor whiteColor] setFill];
//[[UIColor blackColor] setStroke];
CGContextAddPath(context, path);
CGContextDrawPath(context, kCGPathFillStroke);
CGPathRelease(path);
我实现了,但是现在我想在矩形内设置文本,并尝试了
drawRect
方法和许多其他方法...如果有人知道,请提供帮助。
最佳答案
- (void)drawText:(CGFloat)xPosition yPosition:(CGFloat)yPosition canvasWidth:(CGFloat)canvasWidth canvasHeight:(CGFloat)canvasHeight
{
//Here you Can Write whatever you want to add in the rectangle
}
关于ios - 如何将矩形中的文本添加到pdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35380522/