FUIImageView
@IBDesignable
@MainActor
open class FUIImageView : UIImageView, FUIObservableValue, InnerViewContainer
extension FUIImageView: FUIGlyphImage
extension FUIImageView: FUIAttributedGlyphImage
FUIImageView is an enhanced Fiori style UIImageView that provides the option of applying a circular mask to the view’s image property. The view also exposes properties for specifying the width and color of an optional border around the image.
The contentMode of the FUIImageView is set the scaleAspectFit by default
Remark
Implements@IBDesignable
Usage
- Initializing programmatically:
let imageView = FUIImageView(image: UIImage(named: "myProfilePic"))
//set image view to be circular
imageView.isCircular = true
// To enable a default gradient layer behind the placehoder text
imageView.isGradientLayerEnabled = true
// Set placeholder text
imageView.placeholder.text = "This is a placehoder"
// Set placeholder background color
imageView.placeholderBackgroundColor = UIColor.white
- Placing inside a Storyboard or xib:
- Drag and drop an
UIImageViewcomponent to Interface Builder canvas. - Switch class name from
UIImageViewtoFUIImageView', and set module toSAPFiori`. - To apply, set
@IBInspectablepropertyisCircular, totrue
-
Instance of InnerView
Declaration
Swift
@MainActor public internal(set) var _innerView: FUIPlaceholderView! { get }
-
Alias for
FUIPlaceholderView.Declaration
Swift
public typealias InnerView = FUIPlaceholderView -
Undocumented
Declaration
Swift
@MainActor public var isEmpty: Bool { get } -
Implementation of change handler. Is invoked on changes to the
valueproperty.Declaration
Swift
@MainActor open var onChangeHandler: ((UIImage?) -> Void)? -
A boolean to enable a default gradient layer. If
placeholderBackgroundColoris set, the gradient layer won’t be displayed.Declaration
Swift
@MainActor public var isGradientLayerEnabled: Bool { get set } -
An array of CGColors for the gradient layer.
Declaration
Swift
@MainActor public var gradientLayerColors: [CGColor]? { get set } -
Override of
backgroundColor, which prevents thealphalevel of thecgColorfrom being set to0. This enables the background color to remain constant when theFUIImageViewis a subview of thecontentViewof aUITableViewCell, when the cell is tapped.This makes it much more convenient to produce solid color profile images, when setting the
tintColorof the view to.white, and usingisCircular = true.Example:
let cell = FUIObjectTableViewCell(/*...*/) cell.detailImageView.image = FUIIconLibrary.map.marker.asset.withRenderingMode(.alwaysTemplate) cell.detailImageView.backgroundColor = UIColor.blue cell.detailImageView.tintColor = UIColor.white cell.detailImageView.isCircular = trueDeclaration
Swift
@MainActor override open var backgroundColor: UIColor? { get set } -
Background color behind the placeholder text
Declaration
Swift
@MainActor public var placeholderBackgroundColor: UIColor? { get set } -
Override intrinsicContentSize to provide a default image size for Auto Layout
Declaration
Swift
@MainActor override open var intrinsicContentSize: CGSize { get } -
Undocumented
Declaration
Swift
@MainActor override open var gestureRecognizers: [UIGestureRecognizer]? { get set } -
Undocumented
Declaration
Swift
@MainActor override open func addGestureRecognizer(_ gestureRecognizer: UIGestureRecognizer) -
Undocumented
Declaration
Swift
@MainActor override open func removeGestureRecognizer(_ gestureRecognizer: UIGestureRecognizer)
-
Property defining the circular type of the image view. Default is false, which has no ciruclar mask to the image
Declaration
Swift
@IBInspectable @MainActor open var isCircular: Bool { get set } -
Property defining the mask type of the image view. Default is
roundedCorner, where the image view is corner roundedDeclaration
Swift
@MainActor open var maskType: FUIImageView.MaskType { get set } -
Property of supported mask types applied to the image view.
See moreDeclaration
Swift
public enum MaskType : Equatable -
Property defining the border color.
Declaration
Swift
@IBInspectable @MainActor open var borderColor: UIColor? { get set } -
Property defining the border width. A width of 0.0 will result in no border being shown.
Declaration
Swift
@IBInspectable @MainActor open var borderWidth: CGFloat { get set }
-
Undocumented
Declaration
Swift
@MainActor open override var forFirstBaselineLayout: UIView { get } -
Undocumented
Declaration
Swift
@MainActor open override var forLastBaselineLayout: UIView { get } -
Undocumented
Declaration
Swift
@MainActor open var baselineDescenderHeight: CGFloat { get set } -
Developer formatted
glyphImageto be displayed as theFUIGlyphImageDeclaration
Swift
@MainActor public var glyphImage: UIImage? { get } -
Developer formatted
NSAttributedStringto be displayed as theFUIGlyphImageDeclaration
Swift
@MainActor public var attributedText: NSAttributedString! { get } -
Add a size property for
FUIImageViewDeclaration
Swift
@MainActor public var size: CGSize? { get }