New to Xcode, small problem

Discussion in 'Mac Programming' started by JimmyFeatures, Oct 31, 2005.

  1. macrumors newbie

    Joined:
    Oct 31, 2005
    #1
    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.
     
  2. macrumors member

    Joined:
    Jun 19, 2005
    Location:
    Tempe, AZ
    #2
    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.
     
  3. thread starter macrumors newbie

    Joined:
    Oct 31, 2005
    #3
    Thanks, that completely sorted me out.

    And yes, I'm using objective C and cocoa.
     

Share This Page