English 中文(简体)
Observing the table in pdf document
原标题:iOS draw the table in pdf document

I will create the pdf from the contents of UIViewController. When UIViewController has a table region(the same as Excel), I didn t find the method for drawing an table in pdf document. Does anyone know to solve this problem? Please help me.

最佳回答

表格一没有简单的方法知道你是否重新使用Quartz图表(CGContextRef型)。 我能够从方案上建立一个桌子,利用被nes住的国防军,并认真注意间隔,使之正确。

Psuedo-code:

for (int i=0; i < numberOfRows; i++)
{
// display each row
    // Draw row line
    CGPoint horizontalRowDivider[2] = {CGPointMake(x_startPoint, y_startPoint + (i * row_width)), CGPointMake(x_endPoint, y_endPoint + (i * row_width))};
    CGContextStrokeLineSegments(pdfContext, newlineItemDivider, 2);


    for(int j = 0; j < numberOfColumns; j++)
    {
         //Draw each column cell
         const char *desc_text = "Table value"
         CGContextShowTextAtPoint (pdfContext, x_cellDataLoc, y_cellDataLoc, desc_text, strlen(desc_text));
         CGPoint verticalLineCellDivider[2] = {CGPointMake(x_startPoint + (j * col_width), y_startPoint), CGPointMake(x_endPoint + (j * col_width), y_endPoint)};
         CGContextStrokeLineSegments(pdfContext, verticalLineCellDivider, 2);  
    }


}

这是一个粗略的例子,说明你可能用来提一个表格的逻辑。 你可能希望你坐在桌旁的一条直径或一条边界,使你看上去除任何其他种类的ak子,使你想要它。 你们可以找到如何做到这一点的各种方法清单,并且通过以下链接找到更多方法。 我知道这或许是你所铭记的,但我希望这给你一条方向,如果你完全 st。 亲爱!

你们可以找到在 Apple果文件中编造PDF功能的完整图书馆:

问题回答

暂无回答




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签