Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 6/7 Deltas: Only working for subviews?

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:

iOS 6/7 Deltas in Xcode

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.)

like image 220
Mischa Avatar asked Oct 01 '13 15:10

Mischa


2 Answers

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);  
     }
   }

 }
like image 131
bhavya kothari Avatar answered Sep 25 '22 05:09

bhavya kothari


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:

enter image description here

and you can add same delta values for all your subviews from size inspector at one shot...as simple as that!!

enter image description here

like image 43
Ajay Avatar answered Sep 23 '22 05:09

Ajay