OGeek|极客世界-中国程序员成长平台

标题: iphone - 状态栏问题 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 15:12
标题: iphone - 状态栏问题

从我的图片中可以看出,状态栏显示在我的表格 View 顶部,我不明白我做错了什么导致这种情况发生。我相信这将是一个简单的修复,我只是想念它。

任何帮助将不胜感激,谢谢!

In App View



Best Answer-推荐答案


您可以通过在 ViewDidLoad 方法中编写以下代码来避免此问题...

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

让我知道它是否有效!

编码愉快!!!!

关于iphone - 状态栏问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19158325/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4