-
Notifications
You must be signed in to change notification settings - Fork 367
Cosmos configuration
Atacama Large Millimeter Array. The photo was taken by Christoph Malin. Source: European Southern Observatory.
One can configure Cosmos view directly from the storyboard using the attributes inspector. Alternatively, all the configuration options are accessible through the settings
property of the view object.
// Set the color of a filled star
cosmosView.settings.colorFilled = UIColor.orangeColor()
Star settings describe appearance of individual stars in the Cosmos.
-
borderColorEmpty: Border color of an empty star. Default:
#FF9500
color. -
borderWidthEmpty: Width of the border for the empty star. Default:
1
. - colorEmpty: Background color of an empty star. Default: transparent.
-
colorFilled: Background color of a filled star. Default:
#FF9500
color. -
fillMode: Defines how the star is filled when the rating value is not a whole integer. It can either show full stars, half stars or stars partially filled according to the rating value. Default:
.Full
. -
starMargin: Distance between stars. Default:
5
. - starPoints: Array of points for drawing the star with size of 100 by 100 pixels. Supply your points if you need to draw a different shape.
-
starSize: Size of a single star. Default:
20
. -
totalStars: The maximum number of stars to be shown. Default:
5
.
Use the text settings to style the optional text that is shown on the right edge of the Cosmos.
-
textColor: Color of the text. Default:
#FF9500
color. -
textFont: Font for the text. Default: dynamic type with
UIFontTextStyleFootnote
style. -
textMargin: Distance between the text and the stars. Default:
5
.
Touch settings describe the behaviour of Cosmos when used as in input.
-
minTouchRating: The lowest rating that user can set by touching the stars. Default:
1
. -
updateOnTouch: When
true
the star fill level is updated when user touches the Cosmos view. Whenfalse
the Cosmos view only shows the rating and does not act as the input control. Default:true
.