繁体   English   中英

在iOS7.1中使用show(推)segue不会出现导航栏

[英]Navigation bar doesn't appear using show (push) segue in iOS7.1

我有三个带有三个iOS版本的设备。 我将导航栏隐藏在RootViewController 然后对于每个ViewController ,我将导航栏显示为

- (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更改为自定义类型,则会显示导航栏。 但是,如果我更改为“显示(推送)”序列,则导航栏不会显示。 可能是什么问题呢? 我使用了UIStoryBoard的segue。 谢谢

阅读此链接 ,然后尝试

 //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];
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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