Skip to content

Icon resource creation

Dal Rupnik edited this page Jul 20, 2015 · 3 revisions

The old way

ryanolsonk commented on Dec 4, 2014

The format is just a byte array with the image data. You can open the images in a program that lets you see the raw data (i.e. Hex Fiend). The FacebookSDK also has this script which could be helpful in automating the task.

The new way

The current practice is to have the icon drawn in Core Graphics (I really want to avoid shipping external resources). So all the icons you currently see are also drawn like that. Take a look at one of the plugins for example, such as screenshot plugin.

Usually what I do is: design the icon in Photoshop or Illustrator and import it into PaintCode, which generates Core Graphics code for me.

The general way to add an icon is:

  1. Create an Assets folder in plugin
  2. Create a subclass that will represent the icon - extend ALPHAAsset class
  3. Set the drawingSize and drawingBlock properties, see example: https://github.com/Legoless/Alpha/blob/master/Alpha/Plugins/Screenshot/Assets/ALPHAScreenshotIcon.m

DrawingSize property tells the system of the default icon size, this is used to calculate the proper scale. In general it is fine, if you leave it as it is by default. In either case, drawing block will gets a CGRect when called, so icon must be drawn dynamically according to the provided frame rect.

Clone this wiki locally