Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

adcx64

macrumors 65816
Original poster
Nov 17, 2008
1,270
124
Philadelphia
Hi,
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!
 
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
Code:
[myTextField setEnabled:NO];
NOTE:
Labels and TextFields are all NSTextFields, the label is usually not changed by the user.
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.