Figuring out Interface Builder 3.0

  • Hello all,

    I'm brand new to Cocoa development. I recently started learning with the
    Hillegas book and xcode 2. I was able to do the first tutorial (Random
    Number) fine in xcode 2, but I'm not exactly sure how to handle this in
    xcode 3 with the new interface builder. In the IB 2, the controller
    class created was automatically added to the xcode classes group. In IB
    3, I don't see how to tie them together. This is what I've been able to
    make work:

    In IB 3, create the controller instance, add the action and outlet
    items, and connect them. Then I go to File->Write Class Files... and
    browse to the project directory and save as "MyController". Then I go
    back to xcode and manually Add->Existing Files... to add MyController
    files to the classes group.

    Another method I tried was to create the class files in xcode 3 first,
    then in IB 3, select the class file when I instantiate the object. But,
    I still have to write out the class files by browsing to the project
    folder, select the MyController.m file and prompt to replace the files.

    Both methods require me to manually create the class relationship
    between xcode and IB. Is there a better approach?

    TIA
    Monte
  • On lundi, octobre 29, 2007, at 08:17  PM, Monte Ohrt wrote:

    > Hello all,
    >
    > I'm brand new to Cocoa development. I recently started learning with
    > the Hillegas book and xcode 2. I was able to do the first tutorial
    > (Random Number) fine in xcode 2, but I'm not exactly sure how to
    > handle this in xcode 3 with the new interface builder. In the IB 2,
    > the controller class created was automatically added to the xcode
    > classes group. In IB 3, I don't see how to tie them together. This is
    > what I've been able to make work:
    >
    > In IB 3, create the controller instance, add the action and outlet
    > items, and connect them. Then I go to File->Write Class Files... and
    > browse to the project directory and save as "MyController". Then I go
    > back to xcode and manually Add->Existing Files... to add MyController
    > files to the classes group.
    >
    > Another method I tried was to create the class files in xcode 3 first,
    > then in IB 3, select the class file when I instantiate the object.
    > But, I still have to write out the class files by browsing to the
    > project folder, select the MyController.m file and prompt to replace
    > the files.
    >
    > Both methods require me to manually create the class relationship
    > between xcode and IB. Is there a better approach?

    Well, depending on one's point of view, IB 3 is either an evolution or
    a regression when it comes to this task.

    As far as I've experienced it, it's a complete waste of time to try to
    define a class and its outlet in IB 3. The workflow for this task is
    now quite unintuitive (that's the regression part).

    You are better off defining your class and outlets in Xcode 3 and
    benefit from the way improved synchronization features between IB and
    Xcode III (that's the evolution part).

    Based on some attempts to use IB 3 for this, my personal feeling is
    that I accomplish this task way faster in Interface Builder 2.
  • Hey Monte -

    On Oct 29, 2007, at 12:17 PM, Monte Ohrt wrote:

    > Hello all,
    >
    > I'm brand new to Cocoa development. I recently started learning with
    > the Hillegas book and xcode 2. I was able to do the first tutorial
    > (Random Number) fine in xcode 2, but I'm not exactly sure how to
    > handle this in xcode 3 with the new interface builder. In the IB 2,
    > the controller class created was automatically added to the xcode
    > classes group. In IB 3, I don't see how to tie them together. This
    > is what I've been able to make work:
    >
    > In IB 3, create the controller instance, add the action and outlet
    > items, and connect them. Then I go to File->Write Class Files... and
    > browse to the project directory and save as "MyController". Then I
    > go back to xcode and manually Add->Existing Files... to add
    > MyController files to the classes group.
    >
    > Another method I tried was to create the class files in xcode 3
    > first, then in IB 3, select the class file when I instantiate the
    > object. But, I still have to write out the class files by browsing
    > to the project folder, select the MyController.m file and prompt to
    > replace the files.
    >
    > Both methods require me to manually create the class relationship
    > between xcode and IB. Is there a better approach?

    If you declare outlets and actions in Interface Builder, you have to
    manually add them to source files in your Xcode project. This is
    obviously something that could be improved. I think you'll have a much
    better experience if you declare all of your outlets, actions, and
    classes in source files with Xcode. Since Interface Builder 3.0
    automatically reads your header files, you won't have to do any
    synchronization. Sticking to the 'design in Xcode' workflow will
    provide a much more seamless experience.

    Jon Hess

    >
    >
    > TIA
    > Monte
  • Jon Hess wrote:
    > Hey Monte -
    >
    > If you declare outlets and actions in Interface Builder, you have to
    > manually add them to source files in your Xcode project. This is
    > obviously something that could be improved. I think you'll have a much
    > better experience if you declare all of your outlets, actions, and
    > classes in source files with Xcode. Since Interface Builder 3.0
    > automatically reads your header files, you won't have to do any
    > synchronization. Sticking to the 'design in Xcode' workflow will
    > provide a much more seamless experience.
    >
    > Jon Hess
    Hi Jon,

    So what you are saying, it is better to type out the action/outlet code
    in xcode, vs. creating them via the +/- buttons the IB. Did I get that
    right?

    Let's see if I can make this clear for myself :)

    In xcode, create the controller class and add all the IBOutlet/Action
    stuff manually into the .h/.m files. Then in IB, instantiate an object,
    select the class you made in xcode, and IB automatically discovers the
    outlets and actions from the class. Then you can visually connect the
    outlets/actions to the interface buttons and whatnot. Is that correct?
    Am I also correct in the assumption that now there is no reason to
    "Write Class Files..." from IB anymore, you just "Save" ?

    Monte
  • On Oct 29, 2007, at 6:02 PM, Monte Ohrt wrote:

    > Jon Hess wrote:
    >> Hey Monte -
    >>
    >> If you declare outlets and actions in Interface Builder, you have
    >> to manually add them to source files in your Xcode project. This is
    >> obviously something that could be improved. I think you'll have a
    >> much better experience if you declare all of your outlets, actions,
    >> and classes in source files with Xcode. Since Interface Builder 3.0
    >> automatically reads your header files, you won't have to do any
    >> synchronization. Sticking to the 'design in Xcode' workflow will
    >> provide a much more seamless experience.
    >>
    >> Jon Hess
    > Hi Jon,
    >
    > So what you are saying, it is better to type out the action/outlet
    > code in xcode, vs. creating them via the +/- buttons the IB. Did I
    > get that right?
    >
    > Let's see if I can make this clear for myself :)
    >
    > In xcode, create the controller class and add all the IBOutlet/
    > Action stuff manually into the .h/.m files. Then in IB, instantiate
    > an object, select the class you made in xcode, and IB automatically
    > discovers the outlets and actions from the class. Then you can
    > visually connect the outlets/actions to the interface buttons and
    > whatnot. Is that correct? Am I also correct in the assumption that
    > now there is no reason to "Write Class Files..." from IB anymore,
    > you just "Save" ?

    Yeah. Currently that's the most straight forward workflow. If you
    later decide to add actions or outlets, return to your source code,
    insert them, return to IB, and connect them.

    A tip that might help is that you can command double click on your
    controller in IB to jump to the source code in Xcode.

    Jon Hess

    >
    >
    > Monte
previous month october 2007 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