Last active
December 14, 2015 12:18
-
-
Save dimitribouniol/5085495 to your computer and use it in GitHub Desktop.
Some simple functions to help with graphics and positioning on retina devices.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static __inline__ CGFloat MDRound(CGFloat value) | |
{ | |
static CGFloat scale = 0; | |
if (scale <= 0) { | |
scale = [[UIScreen mainScreen] scale]; | |
} | |
return roundf(value*scale)/scale; | |
} | |
static __inline__ CGFloat MDPixel() | |
{ | |
static CGFloat scale = 0; | |
if (scale <= 0) { | |
scale = [[UIScreen mainScreen] scale]; | |
} | |
return 1./scale; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment