views:

209

answers:

2

I need about 100 icons inside my application. Would it be logical to have one large image file with all the icons and then somehow split it up into individual NSImage objects? Is there a way to run some code at build time to regenerate the individual icons?

+4  A: 

Assuming you are indeed using the icons separately, I think it would be more logical to keep them separated, for a couple of reasons:

  1. It might seem more organized to reduce the total number of files, but having one big file with all your icons isn't a terribly organized method of storing them, either. Xcode can deal fine with a large number of icon files.
  2. If you're using version control, it complicates the management of the history a bit. As it stands now, if you need to change an icon, you just change that icon, and you can keep a history of changes to that icon. If the icons are in one big file, then any time you change any icon, that file will show up in the history, so it'll be hard to isolate what changes to what icons you made.
  3. It's probably easier to edit a single icon than a bunch of icons smashed together into one file.
  4. Why write a build script or runtime code to slice up the icons if you don't have to?
mipadi
As a sometime Photoshop user, I have to disagree with 3 (and by extension 2). It is definitely much, much harder to keep control of even five or more related pictures in separate files than in one single file, with layers, groupings, masks and all that jazz, of course. Just imagine wanting to move the shadow under your icons by a few degrees. That said, Photoshop makes exporting 100 icons pretty easy so there's no real reason to do it at runtime. Plus, there used to be an Applescript library that lets you script Photoshop.
Elise van Looij
+1  A: 

100 icons? Woot? Okay,

No it would not be logical. It is possible to split them at runtime, not at build time. I would simply use the easy way and add all icons as different files.

Time Machine
Why do you think it would not be logical? I have seen this done in game programs many times. ie like tiles for a map or animation frames of a character. Its much easier to edit one large file than many small files is it not? (Especially if your using softare that lets you divide your tiles using a grid.
Jacob