Skip to content

Latest commit

 

History

History
197 lines (141 loc) · 9.29 KB

常用属性说明.md

File metadata and controls

197 lines (141 loc) · 9.29 KB

常用属性说明

JXSegmentedView常用属性

属性 说明
indicators 元素必须是遵从JXSegmentedIndicatorProtocol协议的UIView及其子类
defaultSelectedIndex 初始化或者reloadData之前设置,用于指定默认的index
selectedIndex 只读属性,获取当前选中的index
contentEdgeInsetLeft 整体内容的左边距
contentEdgeInsetRight 整体内容的右边距
isContentScrollViewClickTransitionAnimationEnabled 点击切换的时候,contentScrollView的切换是否需要动画

JXSegmentedViewDataSource协议类常用属性

JXSegmentedBaseDataSource常用属性

属性 说明
dataSource 最终传递给JXSegmentedView的数据源数组
itemContentWidth cell的内容宽度,为JXSegmentedViewAutomaticDimension时就以内容计算的宽度为准,否则以itemContentWidth的具体值为准。
itemWidthIncrement 真实的item宽度 = itemContentWidth + itemWidthIncrement。
itemSpacing item之前的间距
isItemSpacingAverageEnabled 当collectionView.contentSize.width小于JXSegmentedView的宽度时,是否将itemSpacing均分。
isItemTransitionEnabled item左右滚动过渡时,是否允许渐变。比如JXSegmentedTitleDataSource的titleZoom、titleNormalColor、titleStrokeWidth等渐变。
isSelectedAnimable 选中的时候,是否需要动画过渡。自定义的cell需要自己处理动画过渡逻辑,动画处理逻辑参考JXSegmentedTitleCell
selectedAnimationDuration 选中动画的时长
isItemWidthZoomEnabled 是否允许item宽度缩放
itemWidthSelectedZoomScale item宽度选中时的scale

JXSegmentedTitleDataSource常用属性

属性 说明
titles title数组
titleNumberOfLines label的numberOfLines
titleNormalColor title普通状态的textColor
titleSelectedColor title选中状态的textColor
titleNormalFont title普通状态时的字体
titleSelectedFont title选中时的字体。如果不赋值,就默认与titleNormalFont一样
isTitleColorGradientEnabled title的颜色是否渐变过渡
isTitleZoomEnabled title是否缩放。使用该效果时,务必保证titleNormalFont和titleSelectedFont值相同。
titleSelectedZoomScale isTitleZoomEnabled为true才生效。是对字号的缩放,比如titleNormalFont的pointSize为10,放大之后字号就是10*1.2=12。
isTitleStrokeWidthEnabled title的线宽是否允许粗细。使用该效果时,务必保证titleNormalFont和titleSelectedFont值相同。
titleSelectedStrokeWidth 用于控制字体的粗细(底层通过NSStrokeWidthAttributeName实现),负数越小字体越粗。
isTitleMaskEnabled title是否使用遮罩过渡

JXSegmentedTitleImageDataSource常用属性

属性 说明
titleImageType JXSegmentedTitleImageType类型,设置文字图片显示类型
normalImageInfos 数量需要和item的数量保持一致。可以是ImageName或者图片地址
selectedImageInfos 数量需要和item的数量保持一致。可以是ImageName或者图片网络地址。如果不赋值,选中时就不会处理图片切换。
loadImageClosure 内部默认通过UIImage(named:)加载图片。如果传递的是图片网络地址或者想自己处理图片加载逻辑,可以通过该闭包处理。
imageSize 图片的尺寸
titleImageSpacing title和image之间的间隔
isImageZoomEnabled 是否开启图片缩放
imageSelectedZoomScale 图片缩放选中时的scale

JXSegmentedTitleOrImageDataSource常用属性

属性 说明
selectedImageInfos 数量需要和item的数量保持一致。可以是ImageName或者图片地址。选中时不显示图片就填nil
loadImageClosure 内部默认通过UIImage(named:)加载图片。如果传递的是图片地址或者想自己处理图片加载逻辑,可以通过该闭包处理。
imageSize 图片尺寸

JXSegmentedTitleGradientDataSource常用属性

属性 说明
titleNormalGradientColors title普通状态下的渐变colors
titleSelectedGradientColors title选中状态下的渐变colors
titleGradientStartPoint title渐变的StartPoint
titleGradientEndPoint title渐变的EndPoint

JXSegmentedTitleAttributeDataSource常用属性

属性 说明
attributedTitles 富文本title数组
selectedAttributedTitles 选中时的富文本,可选。如果要使用确保count与attributedTitles一致。
titleNumberOfLines title的numberOfLines

JXSegmentedNumberDataSource常用属性

属性 说明
numbers 需要和titles数组数量一致,没有数字的item填0!!!
numberWidthIncrement numberLabel的宽度补偿,numberLabel真实的宽度是文字内容的宽度加上补偿的宽度
numberBackgroundColor numberLabel的背景色
numberTextColor numberLabel的textColor
numberFont numberLabel的font
numberOffset numberLabel的默认位置是center在titleLabel的右上角,可以通过numberOffset控制X、Y轴的偏移
numberStringFormatterClosure 如果业务需要处理超过999就像是999+,就可以通过这个闭包实现。默认显示不会对number进行处理

JXSegmentedDotDataSource常用属性

属性 说明
dotStates 数量需要和titles一致,控制红点是否显示
dotSize 红点的size
dotCornerRadius 红点的圆角值,JXSegmentedViewAutomaticDimension等于dotSize.height/2
dotColor 红点的颜色
dotOffset dotView的默认位置是center在titleLabel的右上角,可以通过dotOffset控制X、Y轴的偏移

JXSegmentedIndicatorProtocol协议类常用属性

JXSegmentedIndicatorBaseView常用属性

属性 说明
indicatorWidth 默认JXSegmentedViewAutomaticDimension(与cell的宽度相等)。内部通过getIndicatorWidth方法获取实际的值
indicatorHeight 默认JXSegmentedViewAutomaticDimension(与cell的高度相等)。内部通过getIndicatorHeight方法获取实际的值
indicatorCornerRadius 默认JXSegmentedViewAutomaticDimension (等于indicatorHeight/2)。内部通过getIndicatorCornerRadius方法获取实际的值
indicatorColor 指示器的颜色
indicatorPosition 指示器的位置,top或者bottom
verticalOffset 垂直方向偏移,指示器默认贴着底部或者顶部,verticalOffset越大越靠近中心。
isScrollEnabled 手势滚动、点击切换的时候,是否允许滚动。
scrollAnimationDuration 点击选中时的滚动动画时长
isIndicatorConvertToItemFrameEnabled 是否需要将当前的indicator的frame转换到cell。辅助JXSegmentedTitleDataSourced的isTitleMaskEnabled属性使用。

JXSegmentedIndicatorLineView常用属性

属性 说明
lineStyle JXSegmentedIndicatorLineStyle风格
lineScrollOffsetX lineStyle为lengthenOffset时使用,滚动时x的偏移量

JXSegmentedIndicatorRainbowLineView常用属性

属性 说明
indicatorColors 数量需要与item的数量相等。默认空数组,必须要赋值该属性。segmentedView在reloadData的时候,也要一并更新该属性,不然会出现数组越界。

JXSegmentedIndicatorDotLineView常用属性

属性 说明
lineMaxWidth 线的最大宽度

JXSegmentedIndicatorDoubleLineView常用属性

属性 说明
minLineWidthPercent 线收缩到最小的百分比

JXSegmentedIndicatorBackgroundView常用属性

属性 说明
backgroundWidthIncrement 宽度增量,背景指示器一般要比cell宽一些

JXSegmentedIndicatorTriangleView常用属性

使用继承于JXSegmentedIndicatorBaseView的属性即可

JXSegmentedIndicatorImageView常用属性

属性 说明
image 设置指示器图片

JXSegmentedIndicatorGradientView常用属性

属性 说明
gradientColors 渐变colors
gradientViewWidthIncrement 宽度增量,背景指示器一般要比cell宽一些
gradientLayer 渐变CAGradientLayer,通过它设置startPoint、endPoint等其他属性

JXSegmentedListContainerView常用属性

属性 说明
didAppearPercent 滚动切换的时候,滚动距离超过一页的多少百分比,就认为切换了页面。默认0.5(即滚动超过了半屏,就认为翻页了)。范围0~1,开区间不包括0和1
defaultSelectedIndex 需要和segmentedView.defaultSelectedIndex保持一致,用于触发默认index列表的加载
validListDict 已经加载过的列表字典。key是index,value是对应的列表
dataSource JXSegmentedListContainerViewDataSource类
scrollView 只读属性,内部持有的UIScrollView