3
votes

I'm quite puzzled by what it appears to be a bug in Xcode 4.5. I can't set the autoresizingMask property of the root view of a newly created UIViewController in Interface Builder. These are the steps to reproduce the issue:

  • Create a new Storyboard
  • Uncheck Use Autolayout in the File inspector
  • Select the root view of the default scene
  • Go to the Size Inspector
  • The springs in the Autosizing dialog are dashed, greyed out and can't be clicked (the struts are working properly).

If I delete the existing view and drag a new view from the Object Library, the new view has the autosizingMask enabled (and can't be disabled).

This happened twice on 2 projects I'm working on, but it doesn't happen on a freshly created project. Am I missing something? What can trigger this behavior?

This is the XML of a test storyboard. The first ViewController, with storyboardIdentifier="springsWorking" is the one I edited deleting the original view, the second one with storyboardIdentifier="default" is a default one.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="2844" systemVersion="12C60" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" initialViewController="KEy-1l-Qqy">
<dependencies>
    <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1930"/>
</dependencies>
<scenes>
    <!--View Controller-->
    <scene sceneID="dwh-DZ-gCp">
        <objects>
            <viewController storyboardIdentifier="springsWorking" id="KEy-1l-Qqy" sceneMemberID="viewController">
                <view key="view" contentMode="scaleToFill" id="ngZ-jh-RR4">
                    <rect key="frame" x="0.0" y="20" width="768" height="1004"/>
                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                    <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
                </view>
            </viewController>
            <placeholder placeholderIdentifier="IBFirstResponder" id="jow-h4-M4B" userLabel="First Responder" sceneMemberID="firstResponder"/>
        </objects>
        <point key="canvasLocation" x="-428" y="-327"/>
    </scene>
    <!--View Controller-->
    <scene sceneID="445-Ak-YxL">
        <objects>
            <viewController storyboardIdentifier="default" id="ZA8-km-Ecn" sceneMemberID="viewController">
                <view key="view" contentMode="scaleToFill" id="lRF-Uf-5lh">
                    <rect key="frame" x="0.0" y="20" width="768" height="1004"/>
                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                    <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
                </view>
            </viewController>
            <placeholder placeholderIdentifier="IBFirstResponder" id="fZf-TK-JQE" userLabel="First Responder" sceneMemberID="firstResponder"/>
        </objects>
        <point key="canvasLocation" x="760" y="-313"/>
    </scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
    <simulatedStatusBarMetrics key="statusBar" statusBarStyle="blackTranslucent"/>
    <simulatedOrientationMetrics key="orientation"/>
    <simulatedScreenMetrics key="destination"/>
</simulatedMetricsContainer>

1

1 Answers

11
votes

In the "attributes inspector" (right-hand panel; icon looks like a slider), under "Simulated Metrics" open the "Size" popup and pick "Freeform". This will unlock those controls. (Otherwise, it is matching the size to the full screen, as it thinks that's what you want.)