12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- //
- // JXCategoryDotView.m
- // JXCategoryView
- //
- // Created by jiaxin on 2018/8/20.
- // Copyright © 2018年 jiaxin. All rights reserved.
- //
- #import "JXCategoryDotView.h"
- @implementation JXCategoryDotView
- - (void)initializeData {
- [super initializeData];
- _relativePosition = JXCategoryDotRelativePosition_TopRight;
- _dotSize = CGSizeMake(10, 10);
- _dotCornerRadius = JXCategoryViewAutomaticDimension;
- _dotColor = [UIColor redColor];
- _dotOffset = CGPointZero;
- }
- - (Class)preferredCellClass {
- return [JXCategoryDotCell class];
- }
- - (void)refreshDataSource {
- NSMutableArray *tempArray = [NSMutableArray arrayWithCapacity:self.titles.count];
- for (int i = 0; i < self.titles.count; i++) {
- JXCategoryDotCellModel *cellModel = [[JXCategoryDotCellModel alloc] init];
- [tempArray addObject:cellModel];
- }
- self.dataSource = [NSArray arrayWithArray:tempArray];
- }
- - (void)refreshCellModel:(JXCategoryBaseCellModel *)cellModel index:(NSInteger)index {
- [super refreshCellModel:cellModel index:index];
- JXCategoryDotCellModel *myCellModel = (JXCategoryDotCellModel *)cellModel;
- myCellModel.dotHidden = [self.dotStates[index] boolValue];
- myCellModel.relativePosition = self.relativePosition;
- myCellModel.dotSize = self.dotSize;
- myCellModel.dotColor = self.dotColor;
- myCellModel.dotOffset = self.dotOffset;
- if (self.dotCornerRadius == JXCategoryViewAutomaticDimension) {
- myCellModel.dotCornerRadius = self.dotSize.height/2;
- }else {
- myCellModel.dotCornerRadius = self.dotCornerRadius;
- }
- }
- @end
|