あれ
retinaなのかどうかを調べるの、以下でいいと思ったけど駄目なのか。
CGRect r = [[UIScreen mainScreen] bounds]; CGFloat width = r.size.width; if(width == 320) { NSLog(@"320!"); } else if (width == 640) { NSLog(@"640 retina!"); } else { NSLog(@"わからん! %f", width); }
と思ったらこれか!
CGRect r = [[UIScreen mainScreen] bounds]; int retina = [[UIScreen mainScreen] scale]; if(retina == 2) { // retina CGFloat width = r.size.width; // 320かよ } else if (retina == 1) { // 3G CGFloat width = r.size.width; // 320だね } else { // ??? }
retinaでも320が帰ってきますわ…。