Reputation: 701
How can an outlet referencing connection disappear in the connections inspector but still be there when you right-click on it and that black outlet window opens?
I had a problem Swift 3: Image does not show when setting isHidden=false in which a background UIImageView did never appear when isHidden was set to false. I found that the outlet referencing connection was not there anymore in the connection inspector, but when I right-clicked on the word "Background" under "View Controller Scene" -> "View Controller" -> "View" a black outlet window opened and the connection was there! So I deleted that connection in that black window and the ViewController and control-dragged another IBOutlet from the background UIImageView to the ViewController.
But how can that happen in the first place?
Upvotes: 0
Views: 949
Reputation: 124997
But how can that happen in the first place?
Look at the actual XML in a storyboard file. Objects typically have a <connections>
section that might look like this:
<connections>
<outlet property="nameLabel" destination="ABG-fa-Haa" id="dEC-Ro-Sac"/>
<action selector="buttonAction:" destination="esT-2Y-Pvc" eventType="touchUpInside" id="aCT-ob-Q4d"/>
</connections>
Those are the connections that you create in the storyboard editor. The editor uses information it gleans from the source code to determine which connections it should let you create, but once you create them there's no real connection between the storyboard and the source code that defines outlets and actions. If you subsequently change or remove those definitions, the connections will still be specified in the storyboard until you remove them.
Upvotes: 1