XCode 5 Interface Builder Storyboard locked

XCode’s Interface Builder has an interesting feature which allows you to lock view controllers and/or it’s children. By doing so you are not able to change anything on the locked item unless, of course, you unlock it. This feature is specially useful to prevent accidental dragging of elements and it’s consequent change to an unwanted position.

IB’s locking mechanism works in a very flexible way: you can lock a parent element and make all it’s children inherit the lock level or you can set individually which elements get locked to which levels.

There are several locking levels available, as follows:

  • Inherited – the element’s lock level is set to the same value as it’s parent
  • Nothing – no locking on this element
  • All properties – no element properties can change
  • Localized properties – only the localization-related properties are unable to change
  • Non-localized properties – only the non-localization-related (so-many-dashes…) will be guarded against change

The locking can be set in the Lock drop down that can be found in the Document section in IB’s Identity Inspector. The picture below shows the location in XCode 5 IB:

XCode5 Lock for UIViewControllers

XCode5 Lock for UIViewControllers

After this short introduction let’s get to the problem: you have a Storyboard with locked elements created on XCode 4, have it imported (and converted, more on this later) to XCode 5, want to do a change but every time you try to do it you see a padlock indicating that the Storyboard/element is locked for changes!

No big deal, you say. After disabling locking I can make my change. Well, not at all. There seems to be a bug on XCode 5 that prevents you to unlock an element if the SB has been created in Xcode 4. So, you google it and find nothing. šŸ˜¦ Finally, you dig deep into Apple’s developers forums and find (part) of the answer: basically it says that you have to open your SB with XCode 4, unlock it, and get back to XCode 5.

Alas! You just can’t do it! Apple’s changed the SB file format on XCode 5, and once you import your “old” SB into XCode 5 it get’s converted and you’re not able to open it up again on XCode 4.

As Thomas Wolfe might put it: you can’t go home again! šŸ™‚

So, you’re pretty much screwed stuck: you can’t edit your NEW SB because it’s locked and you need to open it up in it’s OLD format to unlock it because to do so you need it to be in the OLD format but now you got a NEW one. (Confused, already?)

But, fear no more, while Apple’s don’t fix the issue (I’m sure they will do it, right?) here is an alternative: you will edit the SB file and remove the locks manually.

First you will have to open the SB as an XML file. To do so, right click on the SB file in the Project Navigator, choose Open As and then Source Code. See below:

Open SB's as XML

Open SB’s as XML

Next you’ll have to look for the property propertyAccessControl and set it to “none“:

propertyAccessControl="none"

To unlock the whole SB you have to change the value in the documents first node:

SB XML top level node

SB XML top level node

Beware that this might not suffice. You can have individual ViewControllers or Views locked and in such case, if you want to unlock them as well you must go and set propertyAccessControl="none" in all of them.

Experiment and see what works out in your particular case.

Feel free to get in touch with me if you have found a different way to accomplish this.

3 thoughts on “XCode 5 Interface Builder Storyboard locked

  1. I’ve been searching for a fix to this issue for almost a week. The lock was preventing the “View as” device from being altered. Thank you. Pat on the back.

Leave a comment