Laurent Crivello
Laurent Crivello

Reputation: 3931

Retina simulator displays non-retina resolution

In XCode, I have set my IOS simulator as iPhone (Retina 3.5-inch). However in my code, when I display the screen dimensions (using Bounds CGRect), I get 320 x 480 instead of expected 640 x 960. Any idea why ? I am using the latest XCode and output is named iPhone 6.1 Simulator. Thanks.

Upvotes: 0

Views: 732

Answers (2)

Sergei Belous
Sergei Belous

Reputation: 5038

Try this:

  UIScreen *mainScreen = [UIScreen mainScreen];
  UIScreenMode *screenMode = [mainScreen currentMode];
  CGSize realSize = [screenMode size];

Upvotes: 1

Kevin
Kevin

Reputation: 17556

Frame and bounds are measured in points not pixels. On retina devices, 4 pixels will be in 1 point while non-retina devices have 1 pixel for every point.

Upvotes: 1

Related Questions