Unclear on where .h and .m class files get stored

Discussion in 'Mac Programming' started by Sandy Santra, Mar 27, 2009.

  1. macrumors 6502

    Joined:
    Feb 1, 2008
    Location:
    Brooklyn
    #1
    I've worked on very simple Cocoa apps a couple of times in Xcode and there's something that keeps confusing me.

    As I understand it, after I create connections between buttons and class instances, I'm supposed to (over)write the class files [ClassName].m and [ClassName].h. That works fine, yup, and these files have the code in them that they're supposed to.

    But every book I've read said the files are supposed to land (get stored in) the Xcode "Classes" (virtual) folder in the left sidebar in Xcode. They don't. They always end up under the "Resources" folder, along with things like Info.plist, InfoPlist,strings, and MainMenu.xib.

    This just doesn't seem right, if every book says that they're supposed to end up in the Classes folder.

    Are my books out of date? Did something change in Xcode 3.1.2? Or maybe I'm setting up the project wrong, or saving the class files wrong, or have a Preferences setting screwed up?

    I could really use some help on this oddity if anyone can think of something.

    Thanks in advance!
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    It doesn't matter where they are in those virtual folders really. If it bothers you just drag them to the "correct" location.
     
  3. thread starter macrumors 6502

    Joined:
    Feb 1, 2008
    Location:
    Brooklyn
    #3
    Yeah, I just saw the same sentiment echoed on a blog:

    "if you switch back to Xcode, you'll see the generated files in your project window, inside the Classes group. If they appear in the Resources group, or a different group, simply select and then drag them to the Classes group"

    But it's driving me nuts not understanding why Xcode/IB is saving them to the wrong group.
     
  4. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    I generally create the files myself instead of doing what you are doing, but from memory XCode puts them in the group that was selected when you executed the command.
     
  5. thread starter macrumors 6502

    Joined:
    Feb 1, 2008
    Location:
    Brooklyn
    #5
    OMG--that's it!!!

    You saved my life.

    After 3 hours of research in 4 different areas--Google, Xcode mailing list, Xcode program resources, Twitter--YOU ARE THE MAN.

    Thank you thank you thank you.
     

Share This Page