【问题标题】:UISplitViewController: Navigationbar for master view hidden after rotationUISplitViewController:主视图的导航栏在旋转后隐藏
【发布时间】:2014-12-31 11:34:13
【问题描述】:

我有两个导航栏,一个用于主视图,一个用于详细视图。

我在界面构建器中创建了我的UISplitviewController,并附加了一个导航控制器作为主视图和详细视图,并链接了实际视图。详细视图始终显示一个工作导航栏,主视图仅当 iPad 自应用程序启动后未旋转且处于横向模式时。 我已经仔细检查了我的故事板的源代码,但是除了 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

【问题讨论】:

    标签: ios xcode cocoa-touch uinavigationbar uisplitviewcontroller


    【解决方案1】:

    我在我的代码中找到了以下方法(来自我构建的遗留项目):

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

    这是很明显的原因。有趣的是,当视图以横向显示时不会调用此方法 - 这不是我所期望的名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-04
      • 2019-03-12
      • 2012-07-07
      • 1970-01-01
      相关资源
      最近更新 更多