IconGenerator

@available(iOS 9.0, *)
@objcMembers
@objc(PESDKIconGenerator)
open class IconGenerator : NSObject

An icon generator can be used to generate various icons.

Crop Aspects

  • Generates the icon used to display a crop aspect ratio.

    Declaration

    Swift

    @objc(generateCropAspectImageWithWidth:height:ofSize:dottedBorder:showSwitchIcon:)
    open class func generateCropAspectImage(withWidth width: CGFloat, height: CGFloat, of size: CGSize, dottedBorder: Bool, showSwapIcon: Bool) -> UIImage?

    Parameters

    width

    The width of the aspect ratio.

    height

    The height of the aspect ratio.

    size

    The size of the generated icon.

    dottedBorder

    Whether to draw a dotted border or a solid border. If the border is drawn dotted, the background won’t be filled.

    Return Value

    An image for the given crop aspect ratio.

Fonts

  • Generates the icon used to display a string.

    Declaration

    Swift

    @objc(generateTextImageWithFont:ofSize:text:)
    open class func generateTextImage(with font: UIFont, of size: CGSize, text: String = "Ag") -> UIImage?

    Parameters

    font

    The font that should be used in the icon.

    size

    The size of the icon that is generated.

    text

    The text in the icon.

    Return Value

    An image of the given string with the given size.

Colors

  • Generates the icon used to display a color in the menu.

    Declaration

    Swift

    @objc(generateColorImageWithColor:borderColor:ofSize:)
    open class func generateColorImage(with color: UIColor, border borderColor: UIColor, of size: CGSize) -> UIImage?

    Parameters

    color

    The color that should be displayed.

    borderColor

    The color of the border.

    size

    The size of the generated image.

    Return Value

    An icon that can be used to display a color in the menu.