PDA

View Full Version : Unclear on where .h and .m class files get stored




Sandy Santra
Mar 27, 2009, 07:12 AM
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!



robbieduncan
Mar 27, 2009, 07:41 AM
It doesn't matter where they are in those virtual folders really. If it bothers you just drag them to the "correct" location.

Sandy Santra
Mar 27, 2009, 07:47 AM
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.

robbieduncan
Mar 27, 2009, 07:50 AM
But it's driving me nuts not understanding why Xcode/IB is saving them to the wrong group.

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.

Sandy Santra
Mar 27, 2009, 08:26 AM
XCode puts them in the group that was selected when you executed the command.

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.