Class Instance

Discussion in 'iOS Programming' started by Fuzzball27, Dec 22, 2011.

  1. Fuzzball27 macrumors member

    Fuzzball27

    Joined:
    Aug 8, 2011
  2. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #2
    Errr...
    Code:
    ClassName *pointerName = [[ClassName alloc] init];
    *tadaa*

    You have just created a new instance of your class.
     
  3. Fuzzball27 thread starter macrumors member

    Fuzzball27

    Joined:
    Aug 8, 2011
    #3
    Thank you. (you have no idea how long I've been trying to find that)
    Where should I create the instance? In the class.h file?
     
  4. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #4
    This is BAAAASIC Objective-C, I think you should really learn the fundamentals.
    You have to learn what alloc/Init actually does.
    And do you can't send messages to pointers in the Header file.. That's what the IMPLEMENTATION file is for.
    I think it's best for you to go read some basic fundamentals of Objective-C coding, or you will keep on failing writing decent coding..
     

Share This Page