简体   繁体   中英

layout issues when building an old app in xcode 6

I am making some changes in an old app that is not be worked on for more then 2 years. I've build and run the app in xCode 6 and got the following result.

在此处输入图片说明

For the status bar i'm trying the following:

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

Also I'm trying to set View controller-based status bar appearance to NO

Can anybody help me with this? I'm not using storyboards and not planning to do with this app. It are all seperated XIB files.

Thanks in advance !

EDIT

After adding this code:

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

I get the following: 在此处输入图片说明

My tabbar is created in code in my appdelegate:

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

    [self.window makeKeyAndVisible];

Try this, if you want to start the view controller below the status bar (write this code in viewDidLoad method).

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

and if you want to hide the status bar follow this link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM