I designed my iPhone app for iOS 5 and 6. Now I want it to support iOS 7 but the two older versions as well. Like many developers I have been struggling with the status bar overlapping my views and I understand that there is no way to preserve the old status bar style in iOS 7.
Yet many posts on Stackoverflow suggest to use the iOS 6/7 Deltas which can be set in Xcode with the new SDK:
I have tried that but I have found that nothing happens when I apply these values to the root view of a view controller. These Deltas only have an effect on all the subviews contained within the root view.
Why do the Deltas not work for the root view? Is there a way to make it work? (I do not want to add Deltas to all my UI elements in all my view controllers.)
I have found this work around which works fine for me.
-(void)viewWillLayoutSubviews
{
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1)
{
// Load resources for iOS 6.1 or earlier
if(IS_IPhone5)
{
self.view.frame = CGRectMake(0.0, -64.0, 320.0, 568.0);
}
else
{
self.view.frame = CGRectMake(0.0, -64.0, 320.0, 480.0);
}
}
}
From you question What I think is you seems tired of setting delta values for individual subviews. But its very easy I think. Just select all the subviews:
and you can add same delta values for all your subviews from size inspector at one shot...as simple as that!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With