Automatic document icon creation

  • In the past, I had come across some documentation on how one just needs to create an image and Apple will automatically put that image on top of the standard document icon (the sheet with the folded edge).

    However, I can no longer locate this documentation to take advantage of this behavior.

    Anyone know how this works exactly?

    I can, of course, do all the drawing myself, but I like taking advantage of what is provided for me whenever possible.

    Sent from my iPhone
  • On 23 May 2013, at 11:18 AM, Eric Gorr <mailist...> wrote:

    > In the past, I had come across some documentation on how one just needs to create an image and Apple will automatically put that image on top of the standard document icon (the sheet with the folded edge).
    >
    > However, I can no longer locate this documentation to take advantage of this behavior.
    >
    > Anyone know how this works exactly?
    >
    > I can, of course, do all the drawing myself, but I like taking advantage of what is provided for me whenever possible.

    Your question is imprecise (iOS or Mac? How would an icon be set automatically just by creating an image — don't you create lots of images that aren't meant to be icons?), but I think your answer is to be found in

    -[NSWorkspace setIcon:forFile:options:]

    With the string file path and the potential to breach a sandbox, this smells like something that's headed for obsolescence.

    — F

    --
    Fritz Anderson
    Xcode 4 Unleashed: 4.5 supplement for free!
    http://www.informit.com/store/xcode-4-unleashed-9780672333279
  • On May 23, 2013, at 9:42 AM, Fritz Anderson <fritza...> wrote:

    > Your question is imprecise (iOS or Mac?

    iOS doesn’t have document icons, does it?

    > How would an icon be set automatically just by creating an image — don't you create lots of images that aren't meant to be icons?)

    Think build-time. It could be done with some flag in the document-types section of the Info.plist that specifies that this icon is foreground-only and should be composited over a generic document icon. (Sort of like the flag that says that an iOS app icon should be composited with the round corners and reflection.)

    > I think your answer is to be found in -[NSWorkspace setIcon:forFile:options:]

    No, that’s for setting a custom icon on a specific file, not for assigning icons to a file type.

    —Jens
  • "iOS doesn’t have document icons, does it?"

    Correct. From the iOS HIG: "If your iOS app creates documents of a custom
    type, you want users to be able to recognize these documents at a glance.
    You don't need to design a custom icon for this purpose because iOS uses
    your app icon to create document icons for you."

    ./Michael

    On Thu, May 23, 2013 at 11:06 AM, Jens Alfke <jens...> wrote:

    >
    > On May 23, 2013, at 9:42 AM, Fritz Anderson <fritza...>
    > wrote:
    >
    > Your question is imprecise (iOS or Mac?
    >
    >
    > iOS doesn’t have document icons, does it?
    >
    > How would an icon be set automatically just by creating an image — don't
    > you create lots of images that aren't meant to be icons?)
    >
    >
    > Think build-time. It could be done with some flag in the document-types
    > section of the Info.plist that specifies that this icon is foreground-only
    > and should be composited over a generic document icon. (Sort of like the
    > flag that says that an iOS app icon should be composited with the round
    > corners and reflection.)
    >
    > I think your answer is to be found in -[NSWorkspace
    > setIcon:forFile:options:]
    >
    >
    > No, that’s for setting a custom icon on a specific file, not for assigning
    > icons to a file type.
    >
    > —Jens
    >
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Xcode-users mailing list      (<Xcode-users...>)
    > Help/Unsubscribe/Update your Subscription:
    > https://lists.apple.com/mailman/options/xcode-users/<khakionion...>
    >
    > This email sent to <khakionion...>
    >
    >
  • On May 23, 2013, at 12:42 PM, Fritz Anderson <fritza...> wrote:

    > On 23 May 2013, at 11:18 AM, Eric Gorr <mailist...> wrote:
    >
    >> In the past, I had come across some documentation on how one just needs to create an image and Apple will automatically put that image on top of the standard document icon (the sheet with the folded edge).
    >>
    >> However, I can no longer locate this documentation to take advantage of this behavior.
    >>
    >> Anyone know how this works exactly?
    >>
    >> I can, of course, do all the drawing myself, but I like taking advantage of what is provided for me whenever possible.
    >
    > Your question is imprecise (iOS or Mac?

    It is for Mac.

    > How would an icon be set automatically just by creating an image — don't you create lots of images that aren't meant to be icons?),

    In a similar manner that Apple will do it for iOS. According to iOS HIG, Apple will take the app icon and make a composite document icon for you. In the case of the iPad, the automatic document icon will have the folded corner sheet look.

    I could swear there was similar functionality for the Mac, but, perhaps, what I am remembering is this iOS functionality.
  • On May 23, 2013, at 10:43 PM, Eric Gorr wrote:

    > On May 23, 2013, at 12:42 PM, Fritz Anderson <fritza...> wrote:
    >
    >> On 23 May 2013, at 11:18 AM, Eric Gorr <mailist...> wrote:
    >>
    >>> In the past, I had come across some documentation on how one just needs to create an image and Apple will automatically put that image on top of the standard document icon (the sheet with the folded edge).
    >>>
    >>> However, I can no longer locate this documentation to take advantage of this behavior.
    >>>
    >>> Anyone know how this works exactly?
    >>>
    >>> I can, of course, do all the drawing myself, but I like taking advantage of what is provided for me whenever possible.
    >>
    >> Your question is imprecise (iOS or Mac?
    >
    > It is for Mac.
    >
    >> How would an icon be set automatically just by creating an image — don't you create lots of images that aren't meant to be icons?),
    >
    > In a similar manner that Apple will do it for iOS. According to iOS HIG, Apple will take the app icon and make a composite document icon for you. In the case of the iPad, the automatic document icon will have the folded corner sheet look.
    >
    > I could swear there was similar functionality for the Mac, but, perhaps, what I am remembering is this iOS functionality.

    Apple may have provided icon templates at some point in time to build a custom document icon (since just compositing the standard document icon and another icon will not work because of the folded edge and its shadow) but it's not available any more.

    Whether the goal is to build a static .icns (or .iconset) to include it in your app or to dynamically build a .icns/.iconset within your app, you will probably need to get the help of a graphic designer to reproduce the document icon and break it in at least 2 parts (in multiple sizes).
  • On May 24, 2013, at 6:37 AM, Stéphane Sudre <ssudre...> wrote:

    >
    > On May 23, 2013, at 10:43 PM, Eric Gorr wrote:
    >
    >> On May 23, 2013, at 12:42 PM, Fritz Anderson <fritza...> wrote:
    >>
    >>> On 23 May 2013, at 11:18 AM, Eric Gorr <mailist...> wrote:
    >>>
    >>>> In the past, I had come across some documentation on how one just needs to create an image and Apple will automatically put that image on top of the standard document icon (the sheet with the folded edge).
    >>>>
    >>>> However, I can no longer locate this documentation to take advantage of this behavior.
    >>>>
    >>>> Anyone know how this works exactly?
    >>>>
    >>>> I can, of course, do all the drawing myself, but I like taking advantage of what is provided for me whenever possible.
    >>>
    >>> Your question is imprecise (iOS or Mac?
    >>
    >> It is for Mac.
    >>
    >>> How would an icon be set automatically just by creating an image — don't you create lots of images that aren't meant to be icons?),
    >>
    >> In a similar manner that Apple will do it for iOS. According to iOS HIG, Apple will take the app icon and make a composite document icon for you. In the case of the iPad, the automatic document icon will have the folded corner sheet look.
    >>
    >> I could swear there was similar functionality for the Mac, but, perhaps, what I am remembering is this iOS functionality.
    >
    > Apple may have provided icon templates at some point in time to build a custom document icon (since just compositing the standard document icon and another icon will not work because of the folded edge and its shadow) but it's not available any more.

    Actually, it still is, along with several others:

    /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericDocument.icns

    I just thought there was a feature where Apple would compose this generic document icon with one I provided, but it looks like I was either wrong or misremembering.

    And, if anyone is interested, I found the following as well:

    https://github.com/sveinbjornt/docerator
    http://code.google.com/p/docerator/

    but with the unfortunate caveat that it no longer seems to work, but since the source code is available, I might see if I can get it up and running again. For the simple cases, like mine, it would have saved me a bit of time.
previous month may 2013 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