Skip to content

View Attributes

zhenglibao edited this page Jan 12, 2021 · 17 revisions

View attributes

All subclass automatically own all the attributes of parent class.

If the following attributes are not enough, you can extend it with FLEXSET macro.

There are six basic type attributes:

  • string value: the value can be one string. If the string contains comma, you should use \, to prevent mess up, it also support \r(return) \n(newline) \t(table). '\' will be ''. Any other \c will be c.
  • color value: the value can be color, the color be like #rrggbb or #aarrggbb, or the system predefined color (black/white/clear/darkGray/lightGray/gray/red/green/blue/cyan/yellow/magenta/orange/purple/brown), or an image (image must include dot, like img.png)
  • number value: the value must be number
  • number group value: the value should be like n1/n2/...
  • boolean value: the value must be true or false
  • enumeration value: the value should be one of the list
  • @ is special attribute, the value should be filename/stylename. It can be used to reference style in other style file.

UIView attributes:

  • bgColor: color
  • borderWidth: number
  • borderColor: color
  • borderRadius: number
  • shadowOffset: number group (2)
  • shadowRadius: number
  • shadowColor: color
  • contentMode: enumeration -- scaleToFill / scaleAspectFit / scaleAspectFill / redraw / center / top / bottom / left / right / topLeft / topRight / bottomLeft / bottomRight
  • alpha: number
  • tag: number
  • hidden: boolean
  • clipsToBounds: boolean
  • masksToBounds: boolean
  • tintColor: color

新增:

  • shadowOpacity: number
  • layerBounds: number group (4)
  • layerPosition: number group (2)
  • layerZPosition: number
  • layerAnchorPoint: number group (2)
  • layerAnchorPointZ: number
  • layerFrame: number group (4)
  • layerHidden: boolean
  • layerDoubleSided: boolean
  • layerGeometryFlipped: boolean
  • layerMasksToBounds: boolean
  • layerContentsRect: number group (4)
  • layerContentsGravity: string
  • layerContentsScale: number
  • layerContentsCenter: number group (4)
  • layerContentsFormat: string
  • layerMinificationFilter: string
  • layerMagnificationFiltery: string
  • layerMinificationFilterBias: number
  • layerOpaque: boolean
  • layerNeedsDisplayOnBoundsChange:boolean
  • layerDrawsAsynchronously: boolean
  • layerAllowsEdgeAntialiasing: boolean
  • layerBackgroundColor: color
  • layerCornerRadius: number
  • layerOpacity: number
  • allowsGroupOpacity: boolean
  • shouldRasterize: boolean
  • rasterizationScale: number
  • layerName: string
  • userInteractionEnabled:boolean
  • contentScaleFactor: number
  • multipleTouchEnabled: boolean
  • exclusiveTouch: boolean
  • autoresizesSubviews: boolean
  • opaque: boolean
  • clearsContextBeforeDrawing: boolean

//1.8.2增加font

  • font: fontname|number (fontname也可以是bold或者italic),想使用该属性的类必须实现setFont:方法

FlexTouchView attributes:

  • underlayColor: color
  • activeOpacity: number (0~1)

FlexScrollView attributes:

  • horzScroll: boolean
  • vertScroll: boolean

//1.8.2增加

FlexTextView attributes

  • placeholder: string
  • placeholderColor: color

UILabel attributes:

  • text: string
  • fontSize: number
  • lineBreakMode: enumeration -- wordWrapping / charWrapping / clipping / truncatingHead / truncatingTail / truncatingMiddle
  • linesNum: number
  • color: color
  • shadowColor: color
  • highlightTextColor: color
  • textAlign: enumeration -- left / center / right / justified / natural
  • interactEnable: boolean
  • adjustFontSize: boolean

//1.8.2增加

  • lineSpacing: number
  • paragraphSpacing: number
  • firstLineHeadIndent: number
  • headIndent: number
  • tailIndent: number

//2.1.0增加Text和Image两种子元素,用来支持富文本,可以设置的属性包括:name, onPress, attr

  • Text的属性包括:
        text: string
        font: fontname|fontsize
        fontSize: number
        color: color
        bgColor: color
        strike: enumeration --  none, single
        underline: enumeration --  none, single
        kern: number
  • Image的属性包括:
        source: string
        bounds: x/y/w/h
        size: w/h

UIControl attributes:

  • enabled: boolean
  • selected: boolean
  • highlighted: boolean
  • vertAlignment: enumeration -- center / top / bottom / fill
  • horzAlignment: enumeration -- center / left / right / fill / ( leading / trailing: only ios11)

UIButton attributes:

  • title: string
  • color: color

UIImageView attributes:

  • source: string
  • highlightSource: string
  • interactEnable: boolean

UIScrollView attributes:

  • horzIndicator: boolean
  • vertIndicator: boolean
  • pageEnabled: boolean
  • scrollEnabled: boolean
  • bounces: boolean
  • alwaysBounceVertical: boolean // from 1.9.3
  • alwaysBounceHorizontal: boolean // from 1.9.3
  • indicatorStyle: enumeration -- default / black /white

UITextField attributes:

  • text: string
  • placeholder: string
  • fontSize: number
  • color: color
  • textAlign: enumeration -- left / center / right / justified /natural
  • boderStyle: enumeration -- none / line / bezel /roundRect
  • interactEnable: boolean
  • adjustFontSize: boolean
  • autocapitalizationType: enumeration -- none/words/sentences/allCharacters
  • autocorrectionType: enumeration -- default/no/yes
  • spellCheckingType: enumeration -- default/no/yes
  • secureTextEntry: boolean
  • keyboardType: enumeration -- default/asciiCapable/numberAndPunct/url/numberPad/phonePad/namePhonePad/emailAddress/decimalPad/twitter/webSearch/asciiCapableNumberPad
  • keyboardAppearance: enumeration -- default/dark/light/alert
  • returnKeyType: enumeration -- default/go/google/join/next/route/search/send/yahoo/done/emergencyCall/continue
  • clearButtonMode: enumeration -- never/whileEditing/unlessEditing/always
  • enablesReturnKeyAutomatically: boolean
  • leftViewMode: enumeration -- never/whileEditing/unlessEditing/always
  • leftViewMode: enumeration -- never/whileEditing/unlessEditing/always

UITextView attributes:

  • text: string
  • fontSize: number
  • color: color
  • textAlign: enumeration -- left / center / right / justified /natural
  • editable: boolean
  • selectable: boolean
  • autocapitalizationType: enumeration -- none/words/sentences/allCharacters
  • autocorrectionType: enumeration -- default/no/yes
  • spellCheckingType: enumeration -- default/no/yes
  • secureTextEntry: boolean
  • keyboardType: enumeration -- default/asciiCapable/numberAndPunct/url/numberPad/phonePad/namePhonePad/emailAddress/decimalPad/twitter/webSearch/asciiCapableNumberPad
  • keyboardAppearance: enumeration -- default/dark/light/alert
  • returnKeyType: enumeration -- default/go/google/join/next/route/search/send/yahoo/done/emergencyCall/continue
  • enablesReturnKeyAutomatically: boolean

UIActivityIndicatorView attributes:

  • style: enumeration -- whiteLarge / white /gray
  • color: color

UIDatePicker attributes:

  • pickerMode: enumeration -- time / date / dateTime / countDownTimer

UIPageControl attributes:

  • numberOfPages: number
  • currentPage: number
  • hidesForSinglePage: boolean
  • pageTintColor: color
  • curPageTintColor: color

UIPickerView attributes:

  • showSelIndicator: boolean

UIProgressView attributes:

  • style: enumeration -- default / bar
  • progress: number
  • progressTintColor: color
  • trackTintColor: color

UISearchBar attributes:

  • barStyle: enumeration -- default / black / opaque
  • text: string
  • prompt: string
  • placeholder: string
  • bookMarkBtn: boolean
  • cancelBtn: boolean
  • resultBtn: boolean
  • resultBtnSelected: boolean

UISegmentedControl attributes:

  • selectedIndex: number
  • tintColor: color

UISlider attributes:

  • value: number
  • minValue: number
  • maxValue: number
  • continuous: boolean
  • minTintColor: color
  • maxTintColor: color
  • thumbTintColor: color

UIStepper attributes:

  • value: number
  • minValue: number
  • maxValue: number
  • stepValue: number
  • continuous: boolean
  • autorepeat: boolean
  • wraps: boolean
  • tintColor: color

UISwitch attributes:

  • tintColor: color
  • onTintColor: color
  • on: boolean

UITabBar attributes:

  • tintColor: color
  • barTintColor: color
  • unSelTintColor: color
  • itemPosition: enumeration -- auto / fill / center
  • itemSpacing: number
  • itemWidth: number
  • barStyle: enumeration -- default / black /opaque /translucent
  • translucent: boolean

UIToolbar attributes:

  • barStyle: enumeration -- default / black /opaque /translucent
  • translucent: boolean
  • tintColor: color
  • barTintColor: color
Clone this wiki locally