-
Notifications
You must be signed in to change notification settings - Fork 45
Icon resource creation
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 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:
- Create an
Assets
folder in plugin - Create a subclass that will represent the icon - extend
ALPHAAsset
class - Set the
drawingSize
anddrawingBlock
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.