Ios 自定义推送序列删除故事板中的导航栏和选项卡栏

Ios 自定义推送序列删除故事板中的导航栏和选项卡栏,ios,cocoa-touch,ios7,segue,uistoryboardsegue,Ios,Cocoa Touch,Ios7,Segue,Uistoryboardsegue,我在自定义Segue中定义了以下内容,我们称之为SegueX: @interface SegueX : UIStoryboardSegue @end @implementation SegueX - (void)perform { CATransition* transition = [CATransition animation]; transition.duration = 0.3; transition.type = kCATransitionFade;

我在自定义Segue中定义了以下内容,我们称之为SegueX:

@interface SegueX : UIStoryboardSegue
@end

@implementation SegueX

- (void)perform
{
    CATransition* transition = [CATransition animation];

    transition.duration = 0.3;
    transition.type = kCATransitionFade;

    [[self.sourceViewController navigationController].view.layer addAnimation:transition forKey:kCATransition];
    [[self.sourceViewController navigationController] pushViewController:[self destinationViewController] animated:NO];
}

@end
在我的故事板中,我刚刚将一个标准的推式segue改为SegueX。由于某些原因,这将删除我的导航栏和选项卡栏。此外,我在故事板中定义的自定义序列在运行时隐藏。我该如何解决这个问题?我希望不是这样的

在更改为自定义序列之前

更改为自定义序列后

将此保存到Main.storyboard

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="aUj-3O-DdX">
    <dependencies>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
    </dependencies>
    <scenes>
        <!--Navigation Controller-->
        <scene sceneID="prC-ky-DMz">
            <objects>
                <navigationController definesPresentationContext="YES" id="aUj-3O-DdX" sceneMemberID="viewController">
                    <navigationBar key="navigationBar" contentMode="scaleToFill" id="2Uu-Rm-RXH">
                        <autoresizingMask key="autoresizingMask"/>
                    </navigationBar>
                    <toolbar key="toolbar" opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="aOK-Kc-Mfz">
                        <rect key="frame" x="0.0" y="416" width="320" height="44"/>
                        <autoresizingMask key="autoresizingMask"/>
                    </toolbar>
                    <connections>
                        <segue destination="PDT-yG-B9z" kind="relationship" relationship="rootViewController" id="w27-w2-lcd"/>
                    </connections>
                </navigationController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="fNx-r3-Dzg" userLabel="First Responder" sceneMemberID="firstResponder"/>
            </objects>
            <point key="canvasLocation" x="-65" y="-179"/>
        </scene>
        <!--View Controller-->
        <scene sceneID="kMj-Al-ZjY">
            <objects>
                <viewController id="PDT-yG-B9z" sceneMemberID="viewController">
                    <layoutGuides>
                        <viewControllerLayoutGuide type="top" id="RKt-BS-gn9"/>
                        <viewControllerLayoutGuide type="bottom" id="eFe-fv-bG6"/>
                    </layoutGuides>
                    <view key="view" contentMode="scaleToFill" id="JbT-x8-qhX">
                        <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                        <subviews>
                            <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fTw-C6-P3N">
                                <rect key="frame" x="137" y="269" width="46" height="30"/>
                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                <state key="normal" title="Button">
                                    <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
                                </state>
                                <connections>
                                    <segue destination="uMi-ds-4FY" kind="custom" id="mPL-yx-hFQ"/>
                                </connections>
                            </button>
                        </subviews>
                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
                    </view>
                    <navigationItem key="navigationItem" id="Im9-4G-4Ga"/>
                </viewController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="qXF-QN-k3Z" userLabel="First Responder" sceneMemberID="firstResponder"/>
            </objects>
            <point key="canvasLocation" x="473" y="-177"/>
        </scene>
        <!--View Controller-->
        <scene sceneID="ca6-vg-B3h">
            <objects>
                <viewController id="uMi-ds-4FY" sceneMemberID="viewController">
                    <layoutGuides>
                        <viewControllerLayoutGuide type="top" id="jd0-A9-WOV"/>
                        <viewControllerLayoutGuide type="bottom" id="5VJ-sS-U1V"/>
                    </layoutGuides>
                    <view key="view" contentMode="scaleToFill" id="gJp-P2-rUC">
                        <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
                    </view>
                </viewController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="pih-Kj-ioJ" userLabel="First Responder" sceneMemberID="firstResponder"/>
            </objects>
            <point key="canvasLocation" x="1003" y="-179"/>
        </scene>
    </scenes>
    <simulatedMetricsContainer key="defaultSimulatedMetrics">
        <simulatedStatusBarMetrics key="statusBar"/>
        <simulatedOrientationMetrics key="orientation"/>
        <simulatedScreenMetrics key="destination" type="retina4"/>
    </simulatedMetricsContainer>
</document>

尝试检查您是否在故事板上设置了类似

这些度量是在推式视图控制器上推断出来的(但我很确定它不算数)

和/或强制导航栏和底部栏以编程方式显示,在推送的视图控制器的
-视图将出现

[self.navigationController setNavigationBarHidden:NO animated:NO];
[self.navigationController setToolbarHidden:NO animated:NO];

当你改变顺序时,导航栏和工具栏应该在情节提要中消失——这很正常。您可以将底部栏的模拟度量更改为“半透明工具栏”,这会将其添加回来,因此您可以向其添加按钮(您只想更改模拟度量,而不想拖动另一个工具栏以添加第二个工具栏)。您应该仍然可以在运行时看到两个带有按钮的条。

您会很高兴知道,这并不是故意的——我复制了您的代码,它工作得非常好。不幸的是,我不知道你的为什么不起作用。您使用的是什么版本的Xcode和iOS(我的是运行iOS 7.0的Xcode 5.0.1)。我使用的是Xcode 5.0(5A1412),将尝试升级,希望它能工作!现在我安装了Xcode 5.0.2,但不幸的是,它没有帮助,仍然有相同的结果。将使用Seguehmm上的信息更新问题。。。这很奇怪。我假设您的源代码视图控制器仍然嵌入在导航控制器中?如果你能把你的项目发到某个地方或发电子邮件给我,我很乐意看一看。当你改变顺序时,导航栏和工具栏应该会消失在故事板中——这很正常。您可以将底部栏的模拟指标更改为“半透明工具栏”,这会将其添加回来,因此您可以向其添加按钮。但是,在运行时,您仍然可以看到两个带有按钮的条。不,不幸的是,情况并非如此。“按下按钮时隐藏底部栏未选中。第二张图像中的所有内容都是推断的是,如果我按编程方式进行操作,所有内容都可以正常工作。(即使是故事板版本也可以正常工作,但导航项按钮不会在应用程序中创建)所以我实际上在运行时有一个导航栏和一个选项卡栏,但是导航栏中的按钮不存在,而且我无法在故事板中添加按钮,因为导航栏隐藏在这里
(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    ViewController * controller = [[ViewController alloc]init];
    controller.hidesBottomBarWhenPushed=YES;
    if ([segue.identifier isEqualToString:@"Commentsegue"]) {
        //For hiding the tab bar 
        [segue.destinationViewController setHidesBottomBarWhenPushed:YES];
    } 
}