Icon
open class Icon
字体图标抽象基类,子类需继承
-
图标加载器,访问未注册图标时会尝试调用并注册,block返回值为register方法class参数
Declaration
Swift
public static let sharedLoader: Loader<String, Icon.Type>
-
注册图标实现类,必须继承Icon,用于name快速查找,注意name不要重复
Declaration
Swift
open class func registerClass(_ iconClass: Icon.Type)
-
指定名称和大小初始化图标对象
Declaration
Swift
open class func iconNamed(_ name: String, size: CGFloat) -> Icon?
-
指定名称和大小初始化图标图像
Declaration
Swift
open class func iconImage(_ name: String, size: CGFloat) -> UIImage?
-
安装图标字体文件,返回安装结果
Declaration
Swift
@discardableResult open class func installIconFont(_ fileURL: URL) -> Bool
-
自定义字体大小
Declaration
Swift
open var fontSize: CGFloat { get set }
-
自定义背景色
Declaration
Swift
open var backgroundColor: UIColor? { get set }
-
自定义前景色
Declaration
Swift
open var foregroundColor: UIColor? { get set }
-
获取图标字符编码
Declaration
Swift
open var characterCode: String { get }
-
获取图标名称
Declaration
Swift
open var iconName: String { get }
-
返回图标字体
Declaration
Swift
open var iconFont: UIFont { get }
-
自定义图片偏移位置,仅创建Image时生效
Declaration
Swift
open var imageOffset: UIOffset
-
返回字体相同大小的图标Image
Declaration
Swift
open var image: UIImage? { get }
-
生成属性字符串
Declaration
Swift
open var attributedString: NSAttributedString { get }
-
根据字符编码和大小创建图标对象
Declaration
Swift
public init(code: String, size: CGFloat)
-
根据图标名称和大小创建图标对象
Declaration
Swift
public required convenience init?(name: String, size: CGFloat)
-
快速生成指定大小图标Image
Declaration
Swift
open func image(size: CGSize) -> UIImage?
-
设置图标属性,注意不要设置NSFontAttributeName为其他字体
Declaration
Swift
open func setAttributes(_ attrs: [NSAttributedString.Key : Any])
-
添加某个图标属性
Declaration
Swift
open func addAttribute(_ key: NSAttributedString.Key, value: Any)
-
批量添加属性
Declaration
Swift
open func addAttributes(_ attrs: [NSAttributedString.Key : Any])
-
移除指定名称属性
Declaration
Swift
open func removeAttribute(_ key: NSAttributedString.Key)
-
返回图标所有属性
Declaration
Swift
open func attributes() -> [NSAttributedString.Key : Any]
-
返回图标指定属性
Declaration
Swift
open func attribute(_ key: NSAttributedString.Key) -> Any?
-
所有图标名称=>编码映射字典,子类必须重写
Declaration
Swift
open class func iconMapper() -> [String : String]
-
返回指定大小的图标字体,子类必须重写
Declaration
Swift
open class func iconFont(size: CGFloat) -> UIFont