I have an app that runs in landscape orientation. I have used the code below to make it work on iOS 8. This code works perfectly on the simulator for ALL devices. However, when I run it on an iPhone 5 device the layout is wrong. Having read some other questions on here and other places I believed that the screen bounds had been swapped round on iOS 8 when running in landscape mode but it seems that this is not always the case.
CGRect screenBound = [[UIScreen mainScreen] bounds];
CGSize screenSize = screenBound.size;
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
{
ScreenHeight = screenSize.width;
ScreenWidth = screenSize.height;
}
else
{
ScreenHeight = screenSize.height;
ScreenWidth = screenSize.width;
}
Why is the simulator doing something completely different from the device? Does this only affect iPhone 5 or all iPhones/iPads? I don't have access to all devices running different iOS versions so was relying on the simulator to provide accurate results.
Is there a more reliable way of implementing this?