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

JimmyFeatures

macrumors newbie
Original poster
Oct 31, 2005
5
0
I've just started using Xcode, after spending quite sometime using C/C++, and I have a small problem. I have a small program where the user must input text in to a text field, and I want to assign that string to a variable. I have all the outlets and actions set up, I just need to know the syntax of the code.

For example, the outlet that the text field is connected to is called 'input' and I wish to assign that to the variable 'name'.

Thanks.
 

cbiffle

macrumors member
Jun 19, 2005
40
0
Tempe, AZ
JimmyFeatures said:
For example, the outlet that the text field is connected to is called 'input' and I wish to assign that to the variable 'name'.

NSString *name = [input stringValue]; ?

I include the question mark because you didn't specify what language you were writing in (C, Objective-C, C++), what libraries you were using (Carbon, Cocoa, or Java), etc.

If you're using ObjC and Cocoa (which is what I'd recommend), I'd bookmark Apple's docs on the Application Kit and Foundation Kit. You can find most of this information there, or in the tutorials/howtos they link to.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.