哪种方式更适合在性能方面设置属性值?
我不确定哪个更快。尽管我相当确信您的界面生成器设置已加载之前的到您的初始View Controller。这将导致您的界面生成器设置首先加载,并且您的编程设置在加载之后加载(这会覆盖您的界面生成器设置)。
看到这个职位:How does XCode load the main storyboard?
如果通过设置属性 “工具>属性检查器”,在哪个文件 它存储在哪里?
在文本编辑器中打开Main.storyboard,你会看到所有的设置直接存储在XML:
<!-- started from random node -->
<rect key="frame" x="82" y="479" width="211" height="51"/>
<color key="backgroundColor" red="0.17207773850489261" green="0.46615564923228975" blue="0.77629813762626265" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="211" id="S1M-Vg-xbE"/>
<constraint firstAttribute="height" constant="51" id="nr7-Cq-G9C"/>
</constraints>
<fontDescription key="fontDescription" name="AvenirNext-Medium" family="Avenir Next" pointSize="21"/>
<state key="normal" title="Login">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="handleLoginTapped:" destination="dtF-AM-7P4" eventType="touchUpInside" id="iVh-kl-1Hl"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" alpha="0.10000000000000001" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="question" translatesAutoresizingMaskIntoConstraints="NO" id="a1j-ZC-tn9">
<rect key="frame" x="162" y="567" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="PLN-f0-vSm"/>
<constraint firstAttribute="height" constant="50" id="Uga-aV-5p4"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="wra_retina-2" translatesAutoresizingMaskIntoConstraints="NO" id="qkc-Mg-pmQ">
<rect key="frame" x="46" y="20" width="282" height="144"/>
<constraints>
<constraint firstAttribute="height" constant="144" id="OjZ-Nw-qwL"/>
</constraints>
</imageView>
<!-- And on, and on, and on it goes -->
期待在这一个答案。
我已经在一些非常大的应用程序上工作过了,并且从未将性能问题追溯到属性设置。如果您已经使用故事板,请将其设置在故事板中,除非您需要Storyboard无法处理的程序控制。对此,性能不是问题。 –