0

我有两个导航栏,一个用于我的主视图,另一个用于我的详细视图。UISplitViewController:旋转后隐藏的主视图导航栏

我在界面构建器中创建了我的UISplitviewController,并将导航控制器作为主视图和详细视图附加并链接了实际视图。详细视图始终显示工作导航栏,仅当iPad在应用程序启动后处于未旋转状态且处于横向模式时才显示主视图。 我仔细检查了我的故事板的源代码,但船长和细节navigationcontroller是除了ID和X/Y相同:

<!--Navigation Controller--> 
<scene sceneID="dm7-tD-dAR"> 
    <objects> 
     <navigationController id="1xf-lO-tOw" sceneMemberID="viewController"> 
      <extendedEdge key="edgesForExtendedLayout"/> 
      <navigationBar key="navigationBar" contentMode="scaleToFill" translucent="NO" id="rQ3-i9-XSv"> 
       <rect key="frame" x="0.0" y="0.0" width="320" height="44"/> 
       <autoresizingMask key="autoresizingMask"/> 
      </navigationBar> 
      <connections> 
       <segue destination="VeO-5d-klv" kind="relationship" relationship="rootViewController" id="gtO-mE-rZu"/> 
      </connections> 
     </navigationController> 
     <placeholder placeholderIdentifier="IBFirstResponder" id="tEm-wf-PLl" userLabel="First Responder" sceneMemberID="firstResponder"/> 
    </objects> 
    <point key="canvasLocation" x="-1201.5" y="-343"/> 
</scene> 

我试图改变canvasLocation没有使用。细节视图和主视图都从相同的BasicViewController继承。

回答

0

我发现在我的代码下面的方法(从传统的项目,我建立在未来):

- (void) viewWillAppear:(BOOL)animated 
{ 
    self.navigationController.navigationBarHidden = YES; 
} 

这是很明显的原因。有趣的是,当视图出现在横向时,这个方法不会被调用 - 这不是我期望的名称。