1

guys!

One of my views should contain the image of the Mac on which the program is running. It should look like in "About this Mac" window. enter image description here

These images keeps somewhere in system and the question is how to get it programmatically? Objective-C.

I have code that simply substitutes the final image according to the current model, but I need the image loads from the system.

I shall be grateful for any help.

1 Answers1

2

As simple as this:

[NSImage imageNamed:NSImageNameComputer]

For other models look here

Edit: To get higher sizes use following:

  OSType code = UTGetOSTypeFromString((CFStringRef)CFSTR("root"));
  NSImage *computer = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(code)];

where "root" string is from IconsCore.h header file (kComputer).

Community
  • 1
  • 1
Marek H
  • 5,173
  • 3
  • 31
  • 42