iOS tips: How to lock UI element properties in storyboard iOS ?

stocksnap.io

Just do the following:

  1. Click on the UI element you want to lock.
  2. Click on the Identity inspector (check the image above).
  3. Under the Document section, click on the Lock drop down menu and select what is required. Every option is self explanatory .
Document lock options
  • Inherited /Nothing is the default option selected. Here it will use its superviews option.
  • All Properties will lock all the properties so that all the properties in the attributes inspector remains unchangeable.

Select the option “All properties”. Then goto the attributes inspector and try to change any property. ex: I tried to change the title colour of the button here and a lock icon is displayed as shown in the image below.

Lock icon

NOTE: This is the lock option for the document. This means that the UI components properties cannot be edited from storyboard. It can be changed through code by using IBOutlets.

If you want to lock all the views in a ViewController, you can select the upper most view in the view hierarchy (ie; the content view) and change the lock option to All Properties. If all the subviews lock option is inherited, this will work. Otherwise, it will not.

Thats it.!!

Enjoy!!

If you enjoyed reading this post, please share and give some clapps so others can find it 👏👏👏👏👏 !!!!

You can follow me on Medium for fresh articles. Also, connect with me on LinkedIn. Also follow my facebook page on swift: iosswiftblogger.

If you have any comment, question, or recommendation, feel free to post them in the comment section below!

--

--

iOS and tvOS developer, dreamer, photographer 🤨

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abhimuralidharan

Abhimuralidharan

iOS and tvOS developer, dreamer, photographer 🤨