Guest User

Untitled

a guest
Jan 24th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int w = 320;
  2. int h = 480;
  3.  
  4. float ver = [[[UIDevice currentDevice] systemVersion] floatValue];
  5. // You can't detect screen resolutions in pre 3.2 devices, but they are all 320x480
  6. if (ver >= 3.2f)
  7. {
  8.     UIScreen* mainscr = [UIScreen mainScreen];
  9.     w = mainscr.currentMode.size.width;
  10.     h = mainscr.currentMode.size.height;
  11.    
  12.     if (w == 640 && h == 960) // Retina display detected
  13.     {
  14.         // Set contentScale Factor to 2
  15.         self.contentScaleFactor = 2.0;
  16.         // Also set our glLayer contentScale Factor to 2
  17.         eaglLayer.contentsScale=2; //new line
  18.     }
  19. }
Add Comment
Please, Sign In to add comment