Skip to content

Instantly share code, notes, and snippets.

@lynxluna
Created February 21, 2011 18:08
Show Gist options
  • Save lynxluna/837445 to your computer and use it in GitHub Desktop.
Save lynxluna/837445 to your computer and use it in GitHub Desktop.
Code to make your coordinate cartesian, the 0,0 is in the middle of the view
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGSize sz = [self bounds].size;
CGContextTranslateCTM(ctx, 0.0f, sz.height);
CGContextScaleCTM(ctx, 1.0f, -1.0f);
CGContextTranslateCTM(ctx, sz.width * 0.5f, sz.height * 0.5f);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment