cocoa - basic principles

Discussion in 'Mac Programming' started by dale.albiston, Feb 4, 2007.

  1. dale.albiston macrumors member

    Sep 29, 2006
    quick question.

    Am I right in thinking its normal for each window in a cocoa application to basically have at least two parts, the 'nib' file containing the actual form and a custom 'control' object the handles the interface with the actual application as well as custom function code for the window?

    Only asking since I'm more used to vb, which for all its faults is very simple to use.

    not knocking xcode, I actually like it just trying to get my head round the way it works.
  2. whooleytoo macrumors 604


    Aug 2, 2002
    Cork, Ireland.
    More or less true, yes. Of course, you could have several nibs (many applications do); and one controller object per window, or one controller for several windows.

    I've always thought it a pity Apple haven't integrated Xcode and IB - having to manually 'sync' between the two (as in, if you create a new outlet in code, you have to drag the file to IB to inform it of the outlet; or if you create an outlet in IB you may need to merge the code files manually, which can be tricky).
  3. robbieduncan Moderator emeritus


    Jul 24, 2002
  4. dale.albiston thread starter macrumors member

    Sep 29, 2006
    Cheers I figured this was intentional, and not an oversight, basically cus while its long winded it actually works well.

    just nice to know I'm reading it right.

    and the tip on how to tell IB about new outlets etc is most welcome, i've been adding them manually in both IB and XCode.... it works but.. um.. well my goof.

    kinda like the 'merge' feature, which appears to hate me personally. but I'll get there.
  5. kpua macrumors 6502

    Jul 25, 2006
    I personally prefer the drag-the-header-file-onto-the-IB-window method to do this myself. For me, it's easier to just create the outlets and actions in code and have IB create all the entries its little tableviews for me, rather than do it the other way around which is somewhat clunky and requires the whole hassle of merging. This isn't the easiset thing in the world, but considering the options, that's what I always do.

Share This Page