Creating a class from files

  • Hello,

    I'm quite new to Cocoa development and I'm sad to say that I'm stuck
    pretty early on. I was walking through the Currency Converter example
    (with some minor changes), and I cannot get IB to create the
    CustomConverter from the file I laid out. Selecting File -> Read Class
    Files -> CustomController.h doesn't return any errors, but doesn't
    create an instance in my .nib file either.

    I have double checked that I have IBOutlets (and IBActions) in my .h
    file, and the formation is identical to what is shown in the tutorial,
    but still nothing. I'm at a complete loss for what to do to. I made
    sure that the project compiles w/o error (though I know that isn't
    necessary).  Does IB log any output anywhere (I didn't find anything
    in the system logs)?

    Thanks,
    Patrick
  • Hi Patrick,

    > I cannot get IB to create the CustomConverter from the file I laid
    > out.

    Drag in an Object from the Library palette, and set its class to
    CustomConverter. The way to instantiate objects has changed
    significantly in IB 3.0 compared to ≤ 2.5.

    Jonathon Mah
    <me...>
  • Patrick Mahoney wrote:

    > I'm quite new to Cocoa development and I'm sad to say that I'm stuck
    > pretty early on. I was walking through the Currency Converter example
    > (with some minor changes), and I cannot get IB to create the
    > CustomConverter from the file I laid out. Selecting File -> Read Class
    > Files -> CustomController.h doesn't return any errors, but doesn't
    > create an instance in my .nib file either.

    It shouldn't create an instance. Presuming you're working with the
    pre-Leopard tools, it'll create a declaration for the class. You
    still have to manually instantiate the objects you need. You do that
    by switching to the Classes tab, finding your class and using its
    context menu to instantiate.

    G
  • On Jan 12, 2008, at 8:43 AM, Patrick Mahoney wrote:

    > Hello,
    >
    > I'm quite new to Cocoa development and I'm sad to say that I'm stuck
    > pretty early on. I was walking through the Currency Converter
    > example (with some minor changes), and I cannot get IB to create the
    > CustomConverter from the file I laid out. Selecting File -> Read
    > Class Files -> CustomController.h doesn't return any errors, but
    > doesn't create an instance in my .nib file either.

    Hey Patrick -

    That's because "Read Class Files…" only informs interface builder
    about a class. To create an instance of a class, drag an instance of
    "NSObject" out of the library, to your main document window, and then
    use the identity inspector (Command+6) to change the custom class to
    "CustomConverter".

    Jon Hess

    >
    >
    > I have double checked that I have IBOutlets (and IBActions) in my .h
    > file, and the formation is identical to what is shown in the
    > tutorial, but still nothing. I'm at a complete loss for what to do
    > to. I made sure that the project compiles w/o error (though I know
    > that isn't necessary).  Does IB log any output anywhere (I didn't
    > find anything in the system logs)?
    >
    > Thanks,
    > Patrick
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today