UIView display issue in iOS 7

2019-01-18 16:31发布

问题:

I already make the app for ios 6 using xib. All the views are shown perfectly same as xib. But in IOS 7, due to the status Bar the views are moves to up & there is a blank space towards the bottom.

How can I solve this issue?

回答1:

Move your views so they appear correctly for iOS7 and use the iOS6/7 Deltas setting in interface builder to add the correct amount of delta height so your view appears correctly in iOS6.

Also see: https://stackoverflow.com/a/19025547/1545180



回答2:

For IOS7 you have leave status bar height from top which was by default in IOS6.

float SystemVersion=[[[UIDevice currentDevice] systemVersion] floatValue];

if(SystemVersion<7.0f)
{
    //Currently your app is running in IOS6 or older version. So you need not to do anything.  
}
else
{
    // Currently your app is running in IOS7. Do the following.

    CGRect TempRect;
    for(UIView *sub in [[self view] subviews])
    {
        TempRect=[sub frame];
        TempRect.origin.y+=20.0f; //Height of status bar
        [sub setFrame:TempRect];
    }
}


回答3:

Steps to Fix the status bar issue:

  1. Change the "view as" option to "IOS 7 and later" and uncheck the use auto layout option from file inspector.

  2. Go to size inspector and increase 20 pixel of origin y value to all controls added in the selected xib.

  3. And increase the delta value of y to -20 for all the controls added in the selected xib.

And run in both IOS 6 and IOS 7 issues should be fixed. (Make sure the y origin and delta values are perfectly handled as i mentioned.)

For clear information See my answer in this link : https://stackoverflow.com/a/19025547/1545180

For your reference



回答4:

You can easily set the UIView content properly in ios7 and ios6 by using ios6/7 delta shows on the size inspector by changing the values in delta x,delta y,delta width,delta height.firstly set your values for ios7 in x,y,width,height and then check out and then set deltas for ios6 by subtracting and adding numbers.I also do like that and it is so easy ,you can get help from me ant time..thanks



回答5:

If you have a custom UINavigationController try setting the translucent property of the navigationBar to NO like:

navigationBar.translucent = NO;

This worked for me