TTBaseUIImageFontView
DisplayA TTBaseUIImageView subclass that renders AwesomePro icon font glyphs as a UIImage, letting you use any AwesomePro icon as a tintable image view. Supports .Light, .Regular, and raw Unicode CVarArg strings.
🚀 Usage
// Using AwesomePro.Light enum (recommended)
let bellIcon = TTBaseUIImageFontView(
withFontIconLightSize: .bell,
sizeIcon: CGSize(width: 60, height: 60),
colorIcon: TTView.iconColor,
contendMode: .scaleAspectFit
)
// Using AwesomePro.Regular enum
let starIcon = TTBaseUIImageFontView(
withFontIconRegularSize: .star,
sizeIcon: CGSize(width: 40, height: 40),
colorIcon: .systemYellow
)
// Raw string (legacy)
let customIcon = TTBaseUIImageFontView(
withFontIconSize nameIconString: "\u{f007}",
sizeIcon: CGSize(width: 50, height: 50),
colorIcon: .systemBlue
)
// Update icon color dynamically (inherited from TTBaseUIImageView)
bellIcon.setIconColor(.systemRed)
// Constrain size in layout
bellIcon.setWidthAnchor(constant: 24)
.setHeightAnchor(constant: 24)
.setcenterYAnchor(constant: 0)
📖 Initializers
| Init | Icon Source | Notes |
|---|---|---|
init(withFontIconLightSize:sizeIcon:colorIcon:contendMode:) | AwesomePro.Light | Recommended — type-safe |
init(withFontIconRegularSize:sizeIcon:colorIcon:contendMode:) | AwesomePro.Regular | Regular weight icons |
init(withFontIconSize nameString:sizeIcon:colorIcon:contendMode:) | String | Raw Unicode string |
init(withFontIconSize nameCVarIcon:sizeIcon:colorIcon:contendMode:) | CVarArg | Printf-style Unicode |
init() | Default user icon | Convenience init |
Pro Tip: The
sizeIcon parameter is the render resolution of the glyph bitmap — use at least 60×60 for crisp results. The actual view size is controlled separately by Auto Layout constraints. Higher render resolution = sharper icon at larger display sizes.