【问题标题】:layout issues when building an old app in xcode 6在 xcode 6 中构建旧应用程序时的布局问题
【发布时间】:2015-05-27 11:32:11
【问题描述】:

我正在对 2 年以上未使用的旧应用程序进行一些更改。我已经在 xCode 6 中构建并运行了该应用程序并得到了以下结果。

对于状态栏,我正在尝试以下操作:

- (void)viewDidLoad
{
    [super viewDidLoad];
    if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)])
    {
        [self prefersStatusBarHidden];
        [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
    }
    else
    {
        // iOS 6
        [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
    }
}

// Add this method
- (BOOL)prefersStatusBarHidden {
    return YES;
}

我也在尝试将View controller-based status bar appearance 设置为 NO

谁能帮我解决这个问题?我不使用故事板,也不打算使用这个应用程序。都是独立的XIB文件。

提前致谢!

编辑

添加此代码后:

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
self.window.backgroundColor = [UIColor blackColor];
self.window.clipsToBounds =YES;
self.window.frame =  CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
}

我得到以下信息:

我的标签栏是在我的 appdelegate 中的代码中创建的:

 self.tabBarController = [[UITabBarController alloc] init];
    self.tabBarController.viewControllers = [NSArray arrayWithObjects:homeNavigation,bookNavigation,doctorsNavigation,settingsNavigation,locatorNavigation,nil];

    [self.window makeKeyAndVisible];

【问题讨论】:

  • 你试过在.plist文件中设置状态栏设置吗?
  • @the_UB 如果你的意思是查看基于控制器的状态栏外观,那么是 :)
  • 由于您没有提供任何有关您为解决此问题所做的代码,请检查此类似问题how to fix status bar overlap issue in ios 7
  • 试试上面链接中给出的解决方案。
  • @the_UB 请看我的编辑

标签: ios objective-c iphone xcode xib


【解决方案1】:

试试这个,如果你想在状态栏下面启动视图控制器(把这段代码写在viewDidLoad方法中)。

if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
{
    self.edgesForExtendedLayout=UIRectEdgeNone;
}

如果你想隐藏状态栏,请关注link

【讨论】:

    猜你喜欢
    • 2020-03-23
    • 1970-01-01
    • 2014-08-07
    • 2014-07-22
    • 2015-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多