UIView display issue in iOS 7

2019-01-18 16:27发布

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?

5条回答
Juvenile、少年°
2楼-- · 2019-01-18 16:59

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楼-- · 2019-01-18 17:04

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

enter image description here

查看更多
爷的心禁止访问
4楼-- · 2019-01-18 17:09

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楼-- · 2019-01-18 17:11

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.

iOS 6/7 Deltas

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

查看更多
等我变得足够好
6楼-- · 2019-01-18 17:17

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

navigationBar.translucent = NO;

This worked for me

查看更多
登录 后发表回答