我正在使用此代码为图形创建图像
UIImage *newImage=[graph imageOfLayer]
NSData *newPNG= UIImageJPEGRepresentation(newImage, 1.0);
NSString *filePath=[NSString stringWithFormat:@"%@/graph.jpg", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]];
if([newPNG writeToFile:filePath atomically:YES])
NSLog(@"Created new file successfully");
但是我在图像中只获得可见区域(320*460),如何获得带有轴的整个图形图像。 请提供一些代码片段,我如何使用 coreplot 来做到这一点。
提前致谢...
最佳答案
制作一个具有所需输出图像大小的新图表。不必将其添加到托管 View 中 - 只需将其显示在屏幕上。
CPTXYGraph *graph = [(CPTXYGraph *)[CPTXYGraph alloc] initWithFrame:desiredFrame];
// set up the graph as usual
UIImage *newImage=[graph imageOfLayer];
// process output image
关于iphone - Coreplot 库 - 提取整个图形图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9392085/