objective c - iOS 7 Status Bar weird behavior -


I am using a UISplitViewController for an iPad app and I get a strange behavior from StatusBar.

Here's how I start my RootviewController:

  if (kIosVersionFloat> = 7.0) [Application Set StatusBarStyle: UIStatusBarStyleLightContent]; [Application Setstats Barhard: NO]; _window = [[UIWindow alloc] initWithFrame: [[UIScreen main screen] border]]; If ([[UIDwise Current Device] User Interface IDOM] == UIUserInterfaceIdiomPad) {_rootNavigationVC = [[YTRootNavigationController alloc] init]; _rootNavigationVC.navigationBarHidden = Yes; NSShadow * shadow = [[nsshod allok] init]; Shadow.shadowColor = [UIColor colorWithRed: 0.0 green: 0.0 blue: 0.0 alpha: 0.8]; Shadow.shadowOffset = CGSizeMake (0, 1); [[UINavigationBar Presence] setTitleTextAttributes: [NSDiction Dictionary with Object EndCAZ: [UIColor colorWithRed: 245.0 / 255.0 Green: 245.0 / 255.0 Blue: 245.0 / 255.0 alpha: 1.0], NSAI EarthGreenColorAttiturnName, Shadow, NSHowattenamem, [UIFont FontA withname: @ "HELVETICA New-Condensed Black "Size: 21.0], NSFontAttributeName, Zero]]; // rootview controller * firstcc = [[rootview controller alok] init]; detailViewController = [[iPadDetailViewController alloc] init]; YTRootNavigationController * navC = [[YTRootNavigationController alloc] init]; [navC pushViewController: animated detailViewController: no]; NavC.navigationBarHidden = Yes; _slidingVC = [[YTBaseViewController alloc] initWithViewClass: [YTSlidingContainerView class]]; [_rootNavigationVC Push ViewController: Animated _slidingVC: No]; UISplitViewController * splitVC = [[UISplitViewController alloc] init]; SplitVC.viewControllers = [NSArray arrayWithObjects: _rootNavigationVC, navC, zero]; _window = [[UIWindow alloc] initWithFrame: [[UIScreen main screen] border]]; _window.rootViewController = splitVC; }   

And this is how my app looks like: iPad status bar overlapping

I have read some other posts on the stack overflow about the same issue, but did not get much results.

Any suggestions?

I am not using Storyboard or XIB

Assume that you have Your iPadDetailViewController , you can do the following:

First, in your iPadDetailViewController.h , UINavigationBarDelegate

  @ interface ipad diabetic controller: UIViewController & lt; UINavigationBarDelegate & gt;   

Then, in iPadDetailViewController.m , set self.navigationBar.delegate = self inside viewDidLoad And add the following method:

  - (UIBarPosition) status forbar: (id & lt; UIBarPositioning & gt;) bar {CGRect frame = self.navigationBar.frame; Frame.origin = CGPointMake (0, [UIApplication shared application] .statusBarFrame.size.height); Self.navigationBar.frame = frames; Return UIBarPositionTopAttached; }    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -