Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Graph Snapshots

Sam Spencer edited this page Jun 13, 2014 · 6 revisions

On iOS 7.0 and above you can take a snapshot of the line graph view and get a UIImage representation of the snapshot. To do so, simply call the method graphSnapshotImage at anytime in the graph's lifecycle.

- (void)lineGraphDidFinishLoading {
    UIImage *imageOfGraph = [self.myGraph graphSnapshotImage];
}

The snapshot is not of the completed graph, but of the graph in its current state (whether it is in mid-animation or not). Use the lineGraphDidFinishLoading: delegate method to find out when the graph has finished rendering and animating.

The returned UIImage is the size of the graph view's frame (in this example it would be the size of self.myGraph). Additionally, the returned image is at the current screen resolution.