Need some Help w/ Xcode - Objective-c - I'm new at this

Discussion in 'Mac Programming' started by jjardim, Mar 19, 2008.

  1. macrumors newbie

    Joined:
    Mar 19, 2008
    #1
    I've been trying to understand the GUI of Xcode, and Interface builder along w/ learning C. I've made good progress learning, things are clicking here and there but I don't understand the standard methods for a class.

    Example
    I have added an NSTextView object to my .nib file, then added an NSTextField as well. I also added 2 push buttons (NSButton) and linked them up to display text when clicking on the button. But it to display text I could not use the same method.

    On the NSTextView I had to use [textView setString: @"Hello World"];
    On the NSTextField I had to use ..
    [words setStringValue:mad:"Hello, World"];
    [words setNeedsDisplay:YES];

    How can I find out with out searching the internet how to accomplish stuff like this. From working with Visual Basic, I would just type txtField. (and after I typed . it would bring up a list and I would chose settext=) so it showed me all the associated methods with the txtField class. Is there a way for me to find this info out in Xcode?

    Thanks!
    Jason

    just for reference here are my files
    .h
    #import <Cocoa/Cocoa.h>


    @interface AppController : NSObject {
    IBOutlet id textView;

    IBOutlet NSTextField *words;
    }


    - (IBAction) clearText: sender;
    - (IBAction) sayHello: (id)sender;

    @end


    ********************
    .m
    #import "AppController.h"

    @implementation AppController

    - (IBAction) clearText: sender
    {
    [textView setString: @"Hello World "];
    }

    - (IBAction)sayHello:(id)sender{
    [words setStringValue:mad:"Hello, World"];
    [words setNeedsDisplay:YES];
    }

    @end
     
  2. macrumors 6502

    Joined:
    Jun 16, 2004
    #2
    Just turn auto complete on if it isn't already (in XCode's preferences). I think the shortcut to make it pop up is option escape, or something like that (not at my mac at the moment).
     
  3. macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #3
    I'm so sorry, now you get to use a framework with some thought in it :p.

    Seriously now go to Help>Documentation in Xcode, check its set to API and All Doc Sets, then type the name of the class to see what it does.

    If you want more VB-like behaviour enable Autocomplete in Xcode Menu>Preferences>Code Sense>Automatically Suggest
     

Share This Page