Skip to content

Instantly share code, notes, and snippets.

@stigi
Created May 11, 2011 14:09
Show Gist options
  • Save stigi/966511 to your computer and use it in GitHub Desktop.
Save stigi/966511 to your computer and use it in GitHub Desktop.
Flipping Coordinates
CGPoint CGPointFlipped(CGPoint point, CGRect bounds) {
return CGPointMake(point.x, CGRectGetMaxY(bounds)-point.y);
}
CGRect CGRectFlipped(CGRect rect, CGRect bounds) {
return CGRectMake(CGRectGetMinX(rect),
CGRectGetMaxY(bounds)-CGRectGetMaxY(rect),
CGRectGetWidth(rect),
CGRectGetHeight(rect));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment