2013-10-11 73 views
0

UINavigationBar下出現UIStatusBar在iOS 6中(它正常運行在iOS的7),我使用的分鏡與Xocde 5,UINavigationBar的出現在UIStatusBar

: 這裏是我的代碼片段,

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    [UIApplication sharedApplication].statusBarHidden = NO; 

    if ([[[UIDevice currentDevice] systemVersion] floatValue] < 7) //iOS 6 
    { 
     [[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"TabImg.png"]]; 
     [[UINavigationBar appearance] setTintColor:[UIColor colorWithRed:.7 green:.2 blue:.1 alpha:1.0]]; 
     [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque]; 
    } 

    return YES; 
} 

代碼在主頁上,

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

     CRViewController *Obj=[[CRViewController alloc] init]; 
     [self.tabBarController presentViewController:Obj animated:YES completion:nil]; 

} 

當我後didFinishLaunchingWithOptions方法運行我的應用程序被開除,這稱爲CRViewController課程。

守則CRViewController

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    [self.navigationController setNavigationBarHidden:YES]; 
    self.tabBarController.tabBar.hidden = YES; 
    [UIApplication sharedApplication].statusBarHidden = YES; 

    ... 
    ... 
    ... 

} 



- (IBAction)SkipClick:(id)sender { 
    [self dismissViewControllerAnimated:YES completion:nil]; 
} 

-(void)viewDidDisappear:(BOOL)animated{ 
    [self.navigationController setNavigationBarHidden:NO]; 
    self.tabBarController.tabBar.hidden = NO; 
    [UIApplication sharedApplication].statusBarHidden = NO; 
} 

當我在做什麼錯誤?

在此先感謝。

+0

嗨,我面臨着同樣的問題,在我的應用程序,之後存在於您的視圖控制器 – NANNAV

+0

設定延遲時間我應該在哪裏設置? – Krunal

+0

試試這個 - (void)viewDidLoad { [super viewDidLoad]; [self performSelector:@selector(presentListView)withObject:self afterDelay:0。5]; (void)presentListView { } {CRViewController * Obj = [[CRViewController alloc] init];}};}};}}}} [self.tabBarController presentViewController:Obj animated:YES completion:nil]; } – NANNAV

回答

0
Navigation is showing in ios 7 than you have check this it will work 


NSString *version = [[UIDevice currentDevice] systemVersion]; 
int ver = [version intValue]; 
if (ver > 7) 
{ 
} 
else 
{ 
    self.edgesForExtendedLayout = UIRectEdgeNone; 

}

self.tabBarController.tabBar.hidden = YES;不在ios 7中工作,它顯示黑屏。比你可以將其隱藏

- (無效)hideTabBar

{

UITabBar *的TabBar = self.tabBarController.tabBar;

UIView * parent = tabBar.superview; // UILayoutContainerView

UIView * content = [parent.subviews objectAtIndex:0]; // UITransitionView

UIView * window = parent.superview;

[UIView的animateWithDuration:0.5

動畫:^ {

的CGRect tabFrame = tabBar.frame;

tabFrame.origin.y = CGRectGetMaxY(window.bounds);

tabBar.frame = tabFrame; content.frame = window.bounds;

}];

}

相關問題