Swift version: 5.6
Interface Builder is the standard tool for making iOS interfaces using drag and drop, but it does make it remarkably easy to make a mistake – moving a view by accident, adjusting a property with a typo, or perhaps embedding one view inside another by dragging.
Fortunately, there’s a quick and easy fix: you can select any control then lock it so that no more changes can happen. To try it out, select something (e.g. a button), then go to the Class inspector and look for the Lock property. It’s set to “Inherited – (Nothing)” by default, but you can change it to “All Properties” to ensure that it can’t be moved or have any of its settings adjusted.
SPONSORED Fernando's book will guide you in fixing bugs in three real, open-source, downloadable apps from the App Store. Learn applied programming fundamentals by refactoring real code from published apps. Hacking with Swift readers get a $10 discount!
Available from iOS
This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions.
Link copied to your pasteboard.