Ios 从.xib复制到.storyboard并保留IBOutlet连接

Ios 从.xib复制到.storyboard并保留IBOutlet连接,ios,objective-c,iphone,xcode,storyboard,Ios,Objective C,Iphone,Xcode,Storyboard,我正在将旧应用程序从.xib-s迁移到.storyboard-s。那些.xib有许多IBOutlet连接,复制粘贴视图并重新创建它们非常耗时。我想知道是否有一种方法可以无缝地做到这一点。有人知道这个问题的解决办法吗 是的,有办法 确保序列图像板视图控制器场景为视图控制器设置了正确的类 右键单击xib文件,然后选择openas->sourcecode 找到标记对,然后复制该部分 以相同的方式打开情节提要(Open As->Source Code),并在xml中找到相应的视图控制器(以xml注释标记

我正在将旧应用程序从.xib-s迁移到.storyboard-s。那些.xib有许多IBOutlet连接,复制粘贴视图并重新创建它们非常耗时。我想知道是否有一种方法可以无缝地做到这一点。有人知道这个问题的解决办法吗

是的,有办法

  • 确保序列图像板视图控制器场景为视图控制器设置了正确的类

  • 右键单击xib文件,然后选择openas->sourcecode

  • 找到
    标记对,然后复制该部分


  • 以相同的方式打开情节提要(Open As->Source Code),并在xml中找到相应的视图控制器(以xml注释标记,例如
    我认为只要您将ViewController类更改为实际的controller类,Xcode就会自动执行。但是,如果Xcode不自动执行,您将无法执行任何操作。我考虑过这一点,但希望有另一种方法。现在谁想编写一个自动执行此操作的应用程序:)
    
    <viewController id="vXZ-lx-hvc" customClass="TwoViewController" sceneMemberID="viewController">
                <layoutGuides>
                    <viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
                    <viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
                </layoutGuides>
                <view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
                    <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="fLe-1C-hTu">
                            <rect key="frame" x="116" y="244" width="46" height="30"/>
                            <state key="normal" title="Button">
                                <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
                            </state>
                        </button>
                    </subviews>
                    <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
                </view>
            </viewController>
    
        <viewController id="vXZ-lx-hvc" customClass="TwoViewController" sceneMemberID="viewController">
                    <layoutGuides>
                        <viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
                        <viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
                    </layoutGuides>
                    <view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
                        <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="fLe-1C-hTu">
                                <rect key="frame" x="116" y="244" width="46" height="30"/>
                                <state key="normal" title="Button">
                                    <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
                                </state>
                                <connections>
                                    <action selector="samButtonTap:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="1sQ-0S-S8z"/>
                                </connections>
                            </button>
                        </subviews>
                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
                    </view>
                    <connections>
                        <outlet property="samButton" destination="fLe-1C-hTu" id="8GK-Nn-Loy"/>
                    </connections>
                </viewController>