Last Updated: February 25, 2016
·
2.484K
· logicreative

Change simulated metrics in Xcode

It is not possible to change the Simulated Metrics to custom values by Xcode. So everybody having a non-default-size-navbar for example has no option to simulate his custom bar height in the Interface Builder. A possibility is to design the custom navbar and copy it everywhere instead of the navigation, but then it is not simulated any longer.

If this is no option you can "hack" Xcode by jumping to the location
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/PrivatePlugIns/IDEInterfaceBuilderCocoaTouchIntegration.ideplugin/Contents/Resources and open CocoaTouchConstraints.plist In this file you can set the value of NavigationBar to the desired values. So if you want a Navigation Bar that is 60 high just set Maximum and minimum height to 60:

<key>NavigationBar</key>
<dict>
<key>MaximumSize</key>
<string>{10000, 60}</string>
<key>MinimumSize</key>
<string>{0, 60}</string>
</dict>

After saving you need to restart Xcode and you NavigationBar will have the desired height.