iOS 7导航栏内容错误

时间:2015-11-26 13:52:12

标签: ios objective-c ios7 landscape

iOS 7中的导航栏出现问题.iOS 8和iOS 9运行正常。我会尝试解释,我无法显示截图。

我有MainViewController。该主控制器嵌入在导航控制器中。在MainViewController的导航栏中,中间有徽标,左边是菜单图标(经典抽屉),右按钮项是设置。

从菜单控制器中,您可以选择显示记录列表。让我们调用那个列表RecordsViewController。 RecordsViewController在导航栏中有后退按钮,标题和过滤器按钮。每条记录都有一张图片。单击记录时,将显示新的PictureViewController。

在该视图控制器中,您可以向右/向左滑动到上一张/下一张图片。 RecordsViewController和PictureViewController在纵向和横向模式下工作。

我现在将逐步输入以创建问题:

  1. 当你去RecordViewController时,你选择一条记录,点击它然后转到PictureViewController。
  2. 滚动一些图片并将PictureViewController置于横向模式。
  3. 当您回到PictureViewController时,RecordsViewController现在加载了错误的导航栏,它从MainViewController加载导航栏。
  4. 当您在纵向模式下放置它后,它会切换到本应导航栏。
  5. 如果您将RecordsViewController置于横向,选择记录查看图片,PictureViewController将处于横向模式。
  6. 如果您现在点击返回,一切正常。这个问题只发生在iOS 7中。任何想法。?我每次尝试在viewWillAppear导航栏中设置,它都不起作用。
  7. 编辑:我正在使用导航控制器导航栏和项目。所以这是在viewWillAppear中调用的init导航栏方法:

    - (void) initNavBar {
    self.title = @"Records";
    
    self.navigationItem.rightBarButtonItem.tintColor = PRIMARY_BACKGROUND_COLOR;
    
    self.navigationItem.titleView = nil;
    
    self.navigationController.navigationBar.tintColor = SECONDARY_TEXT_COLOR;
    
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName : [UIFont fontWithName:@"ProximaNova-Light" size:17],
                                                                      NSForegroundColorAttributeName : [UIColor blackColor]}];
    
    [self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]];
    }
    

    在我的MainViewController中使用与MainViewController不同的东西完全相同的方法。当我从横向转向纵向模式时,会显示正确的内容。我没有导航栏的插座。我直接使用导航控制器的导航栏。

0 个答案:

没有答案