2015-11-07 30 views
2

我有三個iOS版本的設備。我隱藏導航欄RootViewController。然後,對於每個ViewController,我顯示導航欄作爲導航欄不會出現在iOS7.1中使用show(push)segue

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    self.view.userInteractionEnabled = YES; 
    // Do any additional setup after loading the view. 
    [self.navigationController setNavigationBarHidden:NO]; 
    CGRect frame = CGRectMake(0, 0, 0, 44); 
    UILabel *label = [[UILabel alloc] initWithFrame:frame]; 
    label.backgroundColor = [UIColor clearColor]; 
    label.font = [UIFont fontWithName:@"Helvetica-Bold" size:20.0]; 
    label.textAlignment = NSTextAlignmentCenter; 
    label.textColor = [UIColor blackColor]; 
    label.text = @"Update Height"; 
    self.navigationItem.titleView = label; 
} 

它的工作原理與iOS8.4和iOS9.1兩個設備,但不能用於iOS7.1。對於iOS7.1設備,如果將segue更改爲自定義類型,則會顯示導航欄。但如果我更改爲顯示(推)segue,導航欄不顯示。 可能是什麼問題? 我從UIStoryBoard使用segue。 感謝

+0

[Rü確保導航欄上沒有的故事板製作隱藏? –

回答

2

閱讀本link,然後嘗試這個

//hide on current view controller 
    - (void)viewWillAppear:(BOOL)animated { 
    [super viewWillAppear:animated]; 
    [self.navigationController setNavigationBarHidden:YES animated:YES]; 
} 

// show on next view controller 
- (void)viewWillDisappear:(BOOL)animated { 
    [super viewWillDisappear:animated]; 
    [self.navigationController setNavigationBarHidden:NO animated:YES]; 
} 
+0

我試過了。它仍然是一樣的。仍然隱藏。所有其他設備都能正常工作,只有iOS7.1的設備無法工作。 – batuman

+0

然後像上面的功能實現工作對我來說超過5個項目罰款,如果你喜歡做從appdelegate刪除隱藏的功能,並添加視圖控制器爲基礎的導航控制器hiiden,當然工程 –

+0

其他另一個選項,嘗試在另一個在基於iOS 7 –