PPI of iOS device
float screenResolution() {
struct utsname systemInfo;
uname(&systemInfo);
char *name = systemInfo.machine;
float ppi;
if ((strstr(name, "iPod") != NULL) && (strstr(name, "iPod4") == NULL)) {
// older ipod touches
ppi = 163;
} else if ((strstr(name, "iPhone") != NULL) && (strstr(name, "iPhone3") == NULL)) {
// older non-retina iphones
ppi = 163;
} else if ((strstr(name, "iPad") != NULL) && (strstr(name, "iPad3") == NULL)) {
// ipad 1, ipad 2
ppi = 132;
} else if (strstr(name, "iPad3") != NULL) {
// ipad 3
ppi = 264;
} else {
// iphone 4/4s, ipod touch 4g or simulator
ppi = 326;
}
return ppi;
}