I’ve been working on adapting an iPhone app to iPad. Due to a number of assets which have to be scaled and placed differently, there’s some work to be done in terms of relocating everything.
One thing I’ve noticed is that on the iPad mini, if we use this code:
CGFloat height = [UIScreen mainScreen].currentMode.size.height;
CGFloat width = [UIScreen mainScreen].currentMode.size.width;
The height returned is 1024. This is the long edge of the iPad.
However, if I use the iPad 4 and ask for the height, I get 1536 – which is the shorter edge of the iPad 4. I’ve tried flipping the iPad around while launching and all that, but nothing seems to yield the result I want (height for the iPad 4 = 2048). Does anyone else have this problem? This appears to be a bug on Apple’s side….unless I’m doing something wrong.
That does sound like a bug, but you might be able to get around it by using
boundsinstead ofcurrentMode. The latter property is a measurement of the physical screen and is measured in pixels—and can apparently have arbitrary orientation—whereas the former is the logical screen area, measured in points (what you’re more likely to be laying out your UI in), and should be consistent in size across all existing iPads.