I was wondering how do you set a textfields text in XCode Objective - C.
Asked
Active
Viewed 890 times
-4
-
Xcode is an IDE, objective-c is a language. Are you developing for iOS or OS X? – jrturton Nov 25 '12 at 07:57
1 Answers
4
[myTextField setStringValue: @"a string or an NSString object"];

Anoop Vaidya
- 46,283
- 15
- 111
- 140
-
-
-
1@HamishClaxton Have you connected to the outlet to .h file with outlet named myTextField ? – Anoop Vaidya Nov 25 '12 at 08:00
-
-
-
1@AnoopVaidya Sorry, my comment was based on iOS. Now that we know the question is about OS X - I don't know. – rmaddy Nov 25 '12 at 08:05
-
if you r using xcode4, ctrl+drag from NSTextField to ur appdeletage (the default one) and give outlet name myTextField. It will connect. – Anoop Vaidya Nov 25 '12 at 08:05
-
-
-
I have tried to find as much information as I can, still don't really get it. – HamishClaxton Nov 25 '12 at 08:08
-
read Aaron Hillegas book on cocoa, or u can find so many videos on youtube or lynda's check them – Anoop Vaidya Nov 25 '12 at 08:09
-
setStringValue: is the way to do it. You should make sure your outlet is being set properly. (In the debugger, make sure your textfield variable is not null.) – Mohammad Rabi Nov 25 '12 at 08:29
-