View Full Version : Adding text to a window.

Jun 1, 2011, 08:58 PM
I am setting up a windows to pop up when my app starts. I use interface builder to make a text field, but it can be edited by the end user. how can I add a text field that cannot be editted by the end user, so it displays the same message every time?

Thank You!

Jun 1, 2011, 09:07 PM
You need to use a label NOT a TextField. You can find the label in the Object Library in Interface Builder (or the integrated Xcode 4 editor ) by searching for 'label.' The user will not be able to edit a label. You can also change the state of a text field by unchecking the enabled check box in the IB Inspector.
You could also do it like this in code, provided you have an IBOutlet connected to the NSTextField

[myTextField setEnabled:NO];

Labels and TextFields are all NSTextFields, the label is usually not changed by the user.

Jun 1, 2011, 09:09 PM
In IB there should be a Label object you can drag over. It's really just an NSTextField, but configured to be non-editable, non-selectable and no border.