FUIRatingControl

open class FUIRatingControl : UIControl, Initializable

FUIRatingControl uses images to represent a rating.

The number of “On” images denotes the rating. The default “On” image is a filled star while the default “Off” inmage is an unfilled star.

When the style property is .editable, user can tap an individual image to set the rating. Users can also slide their finger from side to side over the control to select the rating. The FUIRatingControl will send UIControl.Event.valueChanged event when rating changed.

Theming

Supported FUIRatingControl class paths:

fdlFUIRatingControl

Supported RatingControl properties:

on-color { -standard | -accented | -editable-disabled | -editable-disabled }: Color;
off-color { -standard | -accented | -editable-disabled | -editable-disabled }: Color;
on-image { -standard | -editable }: Image;
off-image { -standard | -editable }: Image;
  • The available style for the FUIRatingControl.

    See more

    Declaration

    Swift

    public enum Style
  • The style of this FUIRatingControl.

    The default is .editable

    Declaration

    Swift

    open var style: Style { get set }
  • The range of the rating values.

    The default is 0 through 5. This means that there will be 5 images. If rating is 0, all five images will be using the off image.

    Declaration

    Swift

    open var ratingBounds: ClosedRange<Int> { get set }
  • The rating of this FUIRatingControl.

    The default value is the lower bound of the ratingBounds. less than the lower bound of the ratingBounds.

    • Sets this value below the lower bound of the ratingBounds is interpreted as setting it to the lower bound of the ratingBounds.
    • Sets this value over the upper bound of the ratingBounds is interpreted as setting it to the upper bound of the ratingBounds.

    Declaration

    Swift

    open var rating: Int { get set }
  • The custom image to be used for “On”.

    If this property is not set, the default filled star image will be used.

    Declaration

    Swift

    open var onImage: UIImage?
  • The custom image to be used for “Off”.

    If this property is not set, the default empty star image will be used.

    Declaration

    Swift

    open var offImage: UIImage?
  • The custom fixed size of each item image view.

    If this property is not set, the default size is used.

    Declaration

    Swift

    open var itemSize: CGSize?
  • The custom spacing between item images.

    If this property is not set, the default spacing is used.

    • For styles .readOnlyStandard .readOnlyAccented, the spacing is 2px.
    • For styles .editableEnabled and .editableDisabled, the spacing is 4px.

    Declaration

    Swift

    open var interItemSpacing: CGFloat?
  • Default constructor.

    Declaration

    Swift

    public init(style: Style)

    Parameters

    style

    The style for this FUIRatingControl

  • Convience constructor.

    This constructor is initialized with the .editable style.

    Declaration

    Swift

    required public convenience init()
  • Sets the tintColor for specified range.

    If developer did not set the tint colors, the default color will be used.

    Declaration

    Swift

    open func setTintColor(_ color: UIColor, for range: Range<Int>)

    Parameters

    color

    The color to be applied to the item image for both on and off images.

    range

    The range for this color to be applied. Items out of bounds of the ratingBounds will be ignored.

  • Undocumented

    Declaration

    Swift

    open override func systemLayoutSizeFitting(_ targetSize: CGSize, withHorizontalFittingPriority horizontalFittingPriority: UILayoutPriority, verticalFittingPriority: UILayoutPriority) -> CGSize
  • Undocumented

    Declaration

    Swift

    override public var keyCommands: [UIKeyCommand]? { get }
  • Undocumented

    Declaration

    Swift

    open override var accessibilityHint: String? { get set }