PGPickerView.m 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. //
  2. // PGPickerView.m
  3. // PGPickerView
  4. //
  5. // Created by piggybear on 2017/7/26.
  6. // Copyright © 2017年 piggybear. All rights reserved.
  7. //
  8. #import "PGPickerView.h"
  9. #import "PGPickerColumnView.h"
  10. @interface PGPickerView()<PGPickerColumnViewDelegate>
  11. @property (nonatomic, strong) NSMutableArray<NSNumber *> *animationOfSelectedRowList;
  12. @property (nonatomic, strong) NSMutableArray<NSNumber *> *numberOfSelectedRowList;
  13. @property (nonatomic, strong) NSMutableArray<NSNumber *> *numberOfSelectedComponentList;
  14. @property (nonatomic, strong) NSArray<UIView *> *upLines;
  15. @property (nonatomic, strong) NSArray<UIView *> *downLines;
  16. @property (nonatomic, assign) NSUInteger numberOfRows;
  17. @property (nonatomic, strong) NSArray<PGPickerColumnView *> *columnViewList;
  18. @property (nonatomic, assign) BOOL isSubViewLayouted;
  19. @property (nonatomic, assign) BOOL isSelected;
  20. @end
  21. @implementation PGPickerView
  22. #define kWidth self.frame.size.width
  23. #define kHeight self.frame.size.height
  24. - (instancetype)initWithFrame:(CGRect)frame {
  25. if (self = [super initWithFrame:frame]) {
  26. [self setup];
  27. }
  28. return self;
  29. }
  30. - (instancetype)initWithCoder:(NSCoder *)aDecoder {
  31. if (self = [super initWithCoder:aDecoder]) {
  32. [self setup];
  33. }
  34. return self;
  35. }
  36. - (void)layoutSubviews {
  37. [super layoutSubviews];
  38. if (_isSubViewLayouted) {
  39. return;
  40. }
  41. _isSubViewLayouted = true;
  42. [self setupColumnView];
  43. [self setupView];
  44. [self.upLines enumerateObjectsUsingBlock:^(UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  45. [self bringSubviewToFront:obj];
  46. [self bringSubviewToFront:self.downLines[idx]];
  47. }];
  48. if (_isSelected) {
  49. [self.numberOfSelectedRowList enumerateObjectsUsingBlock:^(NSNumber * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  50. NSInteger component = [self.numberOfSelectedComponentList[idx] integerValue];
  51. BOOL isAnimation = [self.animationOfSelectedRowList[idx] boolValue];
  52. [self selectRow:[obj integerValue] inComponent:component animated:isAnimation];
  53. }];
  54. }
  55. }
  56. - (void)setup {
  57. self.lineBackgroundColor = [UIColor lightGrayColor];
  58. self.textColorOfSelectedRow = [UIColor blackColor];
  59. self.textColorOfOtherRow = [UIColor lightGrayColor];
  60. self.isHiddenMiddleText = true;
  61. self.isHiddenWheels = true;
  62. self.lineHeight = 0.5;
  63. self.verticalLineWidth = 0.5;
  64. self.verticalLineBackgroundColor = self.lineBackgroundColor;
  65. }
  66. - (PGPickerColumnView *)createColumnViewAtComponent:(NSUInteger)component refresh:(BOOL)refresh {
  67. CGFloat width = kWidth / _numberOfComponents;
  68. NSUInteger row = [self.dataSource pickerView:self numberOfRowsInComponent:component];
  69. NSMutableArray *datas = [NSMutableArray arrayWithCapacity:row];
  70. NSMutableArray *colors = [NSMutableArray arrayWithCapacity:row];
  71. for (int j = 0; j < row; j++) {
  72. BOOL tf = true;
  73. NSAttributedString *attriStr = [[NSAttributedString alloc]initWithString:@"?"];
  74. UIColor *color = [UIColor clearColor];
  75. if (self.delegate) {
  76. if ([self.delegate respondsToSelector:@selector(pickerView:attributedTitleForRow:forComponent:)]) {
  77. attriStr = [self.delegate pickerView:self attributedTitleForRow:j forComponent:component];
  78. if (!attriStr) {
  79. tf = false;
  80. }
  81. }else {
  82. tf = false;
  83. }
  84. if (!tf && [self.delegate respondsToSelector:@selector(pickerView:titleForRow:forComponent:)]) {
  85. NSString *title = [self.delegate pickerView:self titleForRow:j forComponent:component];
  86. title = title ? title : @"?";
  87. attriStr = [[NSAttributedString alloc]initWithString:title];
  88. }
  89. if ([self.delegate respondsToSelector:@selector(pickerView:viewBackgroundColorForRow:forComponent:)]) {
  90. UIColor *temp = [self.delegate pickerView:self viewBackgroundColorForRow:j forComponent:component];
  91. if (temp) {
  92. color = temp;
  93. }
  94. }
  95. }
  96. [colors addObject:color];
  97. [datas addObject:attriStr];
  98. }
  99. PGPickerColumnView *view = [self columnViewInComponent:component];
  100. if (!view) {
  101. CGFloat rowHeight = [self rowHeightInComponent:component];
  102. CGFloat upLineHeight = [self upLineHeightForComponent:component];
  103. CGFloat downLineHeight = [self downLineHeightForComponent:component];
  104. view = [[PGPickerColumnView alloc]initWithFrame:CGRectMake(component * width, 0, width, kHeight) rowHeight: rowHeight upLineHeight:upLineHeight downLineHeight:downLineHeight isCycleScroll:self.isCycleScroll datas:datas];
  105. view.delegate = self;
  106. [self addSubview:view];
  107. }
  108. view.isHiddenWheels = self.isHiddenWheels;
  109. view.refresh = refresh;
  110. view.viewBackgroundColors = colors;
  111. view.textFontOfSelectedRow = [self textFontOfSelectedRowInComponent:component];
  112. view.textFontOfOtherRow = [self textFontOfOtherRowInComponent:component];
  113. view.component = component;
  114. view.datas = datas;
  115. view.textColorOfSelectedRow = [self textColorOfSelectedRowInComponent:component];
  116. view.textColorOfOtherRow = [self textColorOfOtherRowInComponent:component];
  117. return view;
  118. }
  119. - (void)setupColumnView {
  120. NSMutableArray *columnViewList = [NSMutableArray arrayWithCapacity:_numberOfComponents];
  121. for (int i = 0; i < _numberOfComponents; i++) {
  122. PGPickerColumnView *view = [self createColumnViewAtComponent:i refresh:false];
  123. [columnViewList addObject:view];
  124. }
  125. self.columnViewList = columnViewList;
  126. }
  127. - (void)setupView {
  128. if (!self.isHiddenMiddleText) {
  129. [self setupMiddleTextLogic];
  130. }
  131. switch (self.type) {
  132. case PGPickerViewLineTypeline:
  133. {
  134. [self setupLineView1];
  135. return;
  136. }
  137. case PGPickerViewLineTypelineSegment:
  138. {
  139. [self setupLineView2];
  140. return;
  141. }
  142. case PGPickerViewLineTypelineVertical:
  143. {
  144. [self setupLineView3];
  145. return;
  146. }
  147. }
  148. }
  149. - (void)setupLineView1 {
  150. NSMutableArray *upLines = [NSMutableArray arrayWithCapacity:_numberOfComponents];
  151. NSMutableArray *downLines = [NSMutableArray arrayWithCapacity:_numberOfComponents];
  152. CGFloat lineWidth = (kWidth / _numberOfComponents);
  153. for (int i = 0; i < _numberOfComponents; i++) {
  154. CGFloat rowHeight = [self rowHeightInComponent:i];
  155. CGFloat upLineHeight = [self upLineHeightForComponent:i];
  156. CGFloat upLinePosY = kHeight / 2 - rowHeight / 2 - upLineHeight;
  157. UIView *upLine = [[UIView alloc]initWithFrame:CGRectMake(i * lineWidth, upLinePosY, lineWidth, upLineHeight)];
  158. upLine.backgroundColor = self.lineBackgroundColor;
  159. [self addSubview:upLine];
  160. [upLines addObject:upLine];
  161. CGFloat downLineHeight = [self downLineHeightForComponent:i];
  162. CGFloat downLinePosY = CGRectGetMaxY(upLine.frame) + rowHeight;
  163. UIView *downLine = [[UIView alloc]initWithFrame:CGRectMake(i * lineWidth, downLinePosY, lineWidth, downLineHeight)];
  164. downLine.backgroundColor = self.lineBackgroundColor;
  165. [self addSubview:downLine];
  166. [downLines addObject:downLine];
  167. }
  168. self.upLines = upLines;
  169. self.downLines = downLines;
  170. }
  171. - (void)setupLineView2 {
  172. NSMutableArray *upLines = [NSMutableArray arrayWithCapacity:_numberOfComponents];
  173. NSMutableArray *downLines = [NSMutableArray arrayWithCapacity:_numberOfComponents];
  174. CGFloat lineWidth = (self.frame.size.width / _numberOfComponents) - 20;
  175. CGFloat space = (self.frame.size.width / _numberOfComponents);
  176. if (_numberOfComponents == 1) {
  177. CGFloat rowHeight = [self rowHeightInComponent:0];
  178. CGFloat upLineHeight = [self upLineHeightForComponent:0];
  179. upLineHeight = upLineHeight > 1.5 ? upLineHeight: 1.5;
  180. CGFloat upLinePosY = kHeight / 2 - rowHeight / 2 - upLineHeight;
  181. UIView *upLine = [[UIView alloc]initWithFrame:CGRectMake(self.frame.size.width / 2 - 43, upLinePosY, 90, upLineHeight)];
  182. upLine.backgroundColor = self.lineBackgroundColor;
  183. [self addSubview:upLine];
  184. [upLines addObject:upLine];
  185. CGFloat downLineHeight = [self downLineHeightForComponent:0];
  186. downLineHeight = downLineHeight > 1.5 ? downLineHeight: 1.5;
  187. CGFloat downLinePosY = CGRectGetMaxY(upLine.frame) + rowHeight;
  188. UIView *downLine = [[UIView alloc]initWithFrame:CGRectMake(self.frame.size.width / 2 - 43, downLinePosY, 90, downLineHeight)];
  189. downLine.backgroundColor = self.lineBackgroundColor;
  190. [self addSubview:downLine];
  191. [downLines addObject:downLine];
  192. self.upLines = upLines;
  193. self.downLines = downLines;
  194. return;
  195. }
  196. for (int i = 0; i < _numberOfComponents; i++) {
  197. CGFloat rowHeight = [self rowHeightInComponent:i];
  198. CGFloat upLineHeight = [self upLineHeightForComponent:i];
  199. upLineHeight = upLineHeight > 1.5 ? upLineHeight: 1.5;
  200. CGFloat upLinePosY = kHeight / 2 - rowHeight / 2 - upLineHeight;
  201. UIView *upLine = [[UIView alloc]initWithFrame:CGRectMake(10 + space * i, upLinePosY, lineWidth, upLineHeight)];
  202. upLine.backgroundColor = [self upLineBackgroundColorForComponent:i];
  203. [self addSubview:upLine];
  204. [upLines addObject:upLine];
  205. CGFloat downLineHeight = [self downLineHeightForComponent:i];
  206. downLineHeight = downLineHeight > 1.5 ? downLineHeight: 1.5;
  207. CGFloat downLinePosY = CGRectGetMaxY(upLine.frame) + rowHeight;
  208. UIView *downLine = [[UIView alloc]initWithFrame:CGRectMake(10 + space * i, downLinePosY, lineWidth, downLineHeight)];
  209. downLine.backgroundColor = [self downLineBackgroundColorForComponent:i];
  210. [self addSubview:downLine];
  211. [downLines addObject:downLine];
  212. }
  213. self.upLines = upLines;
  214. self.downLines = downLines;
  215. }
  216. - (void)setupLineView3 {
  217. CGFloat space = (self.frame.size.width / _numberOfComponents);
  218. [self setupLineView2];
  219. for (int i = 0; i < _numberOfComponents; i++) {
  220. if (i != _numberOfComponents - 1) {
  221. CGFloat width = [self verticalLineWidthForComponent:i];
  222. UIView *verticalLine = [[UIView alloc]initWithFrame:CGRectMake(space * (i+1), 0, width, kHeight)];
  223. verticalLine.backgroundColor = [self verticalLineBackgroundColorForComponent:i];
  224. [self addSubview:verticalLine];
  225. }
  226. }
  227. }
  228. - (void)setupMiddleTextLogic {
  229. CGFloat lineWidth = (self.frame.size.width / _numberOfComponents);
  230. CGFloat space = 10;
  231. for (int i = 0; i < _numberOfComponents; i++) {
  232. UILabel *label = [[UILabel alloc]init];
  233. if ([self.delegate respondsToSelector:@selector(pickerView:middleTextSpaceForcomponent:)]) {
  234. space = [self.delegate pickerView:self middleTextSpaceForcomponent:i];
  235. }
  236. label.frame = CGRectMake(lineWidth / 2 + lineWidth * i + space, kHeight / 2 - 15, 30, 30);
  237. NSString *text = @"";
  238. if ([self.delegate respondsToSelector:@selector(pickerView:middleTextForcomponent:)]) {
  239. text = [self.delegate pickerView:self middleTextForcomponent:i];
  240. }
  241. label.text = text;
  242. label.textColor = self.middleTextColor;
  243. label.font = self.middleTextFont;
  244. [self addSubview:label];
  245. }
  246. }
  247. - (UIColor *)verticalLineBackgroundColorForComponent:(NSInteger)component {
  248. if (self.delegate && [self.delegate respondsToSelector:@selector(pickerView:verticalLineBackgroundColorForComponent:)]) {
  249. return [self.delegate pickerView:self verticalLineBackgroundColorForComponent:component];
  250. }
  251. return self.verticalLineBackgroundColor;
  252. }
  253. - (CGFloat)verticalLineWidthForComponent:(NSInteger)component {
  254. if (self.delegate && [self.delegate respondsToSelector:@selector(pickerView:verticalLineWidthForComponent:)]) {
  255. return [self.delegate pickerView:self verticalLineWidthForComponent:component];
  256. }
  257. return self.verticalLineWidth;
  258. }
  259. - (UIColor *)upLineBackgroundColorForComponent:(NSInteger)component {
  260. if (self.delegate && [self.delegate respondsToSelector:@selector(pickerView:upLineBackgroundColorForComponent:)]) {
  261. return [self.delegate pickerView:self upLineBackgroundColorForComponent:component];
  262. }
  263. return self.lineBackgroundColor;
  264. }
  265. - (UIColor *)downLineBackgroundColorForComponent:(NSInteger)component {
  266. if (self.delegate && [self.delegate respondsToSelector:@selector(pickerView:downLineBackgroundColorForComponent:)]) {
  267. return [self.delegate pickerView:self downLineBackgroundColorForComponent:component];
  268. }
  269. return self.lineBackgroundColor;
  270. }
  271. - (CGFloat)upLineHeightForComponent:(NSInteger)component {
  272. if (self.delegate && [self.delegate respondsToSelector:@selector(pickerView:upLineHeightForComponent:)]) {
  273. return [self.delegate pickerView:self upLineHeightForComponent:component];
  274. }
  275. return self.lineHeight;
  276. }
  277. - (CGFloat)downLineHeightForComponent:(NSInteger)component {
  278. if (self.delegate && [self.delegate respondsToSelector:@selector(pickerView:downLineHeightForComponent:)]) {
  279. return [self.delegate pickerView:self downLineHeightForComponent:component];
  280. }
  281. return self.lineHeight;
  282. }
  283. - (UIColor *)textColorOfSelectedRowInComponent:(NSInteger)component {
  284. if (self.delegate && [self.delegate respondsToSelector:@selector(pickerView:textColorOfSelectedRowInComponent:)]) {
  285. return [self.delegate pickerView:self textColorOfSelectedRowInComponent:component];
  286. }
  287. return self.textColorOfSelectedRow;
  288. }
  289. - (UIColor *)textColorOfOtherRowInComponent:(NSInteger)component {
  290. if (self.delegate && [self.delegate respondsToSelector:@selector(pickerView:textColorOfOtherRowInComponent:)]) {
  291. return [self.delegate pickerView:self textColorOfOtherRowInComponent:component];
  292. }
  293. return self.textColorOfOtherRow;
  294. }
  295. - (NSInteger)numberOfRowsInComponent:(NSInteger)component {
  296. if (self.dataSource && [self.dataSource respondsToSelector:@selector(pickerView:numberOfRowsInComponent:)]) {
  297. return [self.dataSource pickerView:self numberOfRowsInComponent:component];
  298. }
  299. return 0;
  300. }
  301. - (NSInteger)selectedRowInComponent:(NSInteger)component {
  302. PGPickerColumnView *view = [self columnViewInComponent:component];
  303. if (view) {
  304. return view.selectedRow;
  305. }
  306. return -1;
  307. }
  308. - (NSString *)textOfSelectedRowInComponent:(NSInteger)component {
  309. PGPickerColumnView *view = [self columnViewInComponent:component];
  310. if (view) {
  311. return view.textOfSelectedRow;
  312. }
  313. return nil;
  314. }
  315. - (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated {
  316. if (_isSubViewLayouted) {
  317. PGPickerColumnView *view = [self columnViewInComponent:component];
  318. [view selectRow:row animated:animated];
  319. return;
  320. }
  321. if (!_isSubViewLayouted) {
  322. [self.numberOfSelectedComponentList addObject:@(component)];
  323. [self.numberOfSelectedRowList addObject:@(row)];
  324. [self.animationOfSelectedRowList addObject:@(animated)];
  325. }
  326. _isSelected = true;
  327. }
  328. - (CGFloat)rowHeightInComponent:(NSInteger)component {
  329. if (self.delegate && [self.delegate respondsToSelector:@selector(rowHeightInPickerView:forComponent:)]) {
  330. return [self.delegate rowHeightInPickerView:self forComponent: component];
  331. }else if (self.rowHeight != 0) {
  332. return self.rowHeight;
  333. }
  334. self.rowHeight = 44;
  335. return self.rowHeight;
  336. }
  337. - (UIFont *)textFontOfSelectedRowInComponent:(NSInteger)component {
  338. if (self.delegate && [self.delegate respondsToSelector:@selector(pickerView:textFontOfSelectedRowInComponent:)]) {
  339. return [self.delegate pickerView:self textFontOfSelectedRowInComponent:component];
  340. }
  341. return self.textFontOfSelectedRow;
  342. }
  343. - (UIFont *)textFontOfOtherRowInComponent:(NSInteger)component {
  344. if (self.delegate && [self.delegate respondsToSelector:@selector(pickerView:textFontOfOtherRowInComponent:)]) {
  345. return [self.delegate pickerView:self textFontOfOtherRowInComponent:component];
  346. }
  347. return self.textFontOfOtherRow;
  348. }
  349. - (PGPickerColumnView *)columnViewInComponent:(NSUInteger)component {
  350. if (!self.columnViewList || self.columnViewList.count == 0) {
  351. return nil;
  352. }
  353. __block PGPickerColumnView *view = nil;
  354. [self.columnViewList enumerateObjectsUsingBlock:^(PGPickerColumnView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  355. if (obj.component == component) {
  356. view = obj;
  357. *stop = true;
  358. }
  359. }];
  360. return view;
  361. }
  362. - (void)reloadComponent:(NSInteger)component {
  363. [self createColumnViewAtComponent:component refresh:false];
  364. }
  365. - (void)reloadComponent:(NSInteger)component refresh:(BOOL)refresh {
  366. [self createColumnViewAtComponent:component refresh:refresh];
  367. }
  368. - (void)reloadAllComponents {
  369. [self setupColumnView];
  370. }
  371. #pragma mark - PGPickerColumnViewDelegate
  372. - (void)pickerColumnView:(PGPickerColumnView *)pickerColumnView didSelectRow:(NSInteger)row {
  373. if (self.delegate && [self.delegate respondsToSelector:@selector(pickerView:didSelectRow:inComponent:)]) {
  374. [self.delegate pickerView:self didSelectRow:row inComponent:pickerColumnView.component];
  375. }
  376. }
  377. - (void)pickerColumnView:(PGPickerColumnView *)pickerColumnView title:(NSString *)title didSelectRow:(NSInteger)row {
  378. if (self.delegate && [self.delegate respondsToSelector:@selector(pickerView:title:didSelectRow:inComponent:)]) {
  379. [self.delegate pickerView:self title:title didSelectRow:row inComponent:pickerColumnView.component];
  380. }
  381. }
  382. - (UIFont *)pickerColumnView:(PGPickerColumnView *)pickerColumnView textFontOfOtherRow:(NSInteger)row InComponent:(NSInteger)component {
  383. if (self.delegate && [self.delegate respondsToSelector:@selector(pickerView:textFontOfOtherRow:InComponent:)]) {
  384. return [self.delegate pickerView:self textFontOfOtherRow:row InComponent:component];
  385. }
  386. return self.textFontOfOtherRow;
  387. }
  388. - (UIColor *)pickerColumnView:(PGPickerColumnView *)pickerColumnView textColorOfOtherRow:(NSInteger)row InComponent:(NSInteger)component {
  389. if (self.delegate && [self.delegate respondsToSelector:@selector(pickerView:textColorOfOtherRow:InComponent:)]) {
  390. return [self.delegate pickerView:self textColorOfOtherRow:row InComponent:component];
  391. }
  392. return self.textColorOfOtherRow;
  393. }
  394. #pragma mark - Setter
  395. - (void)setDataSource:(id<PGPickerViewDataSource>)dataSource {
  396. _dataSource = dataSource;
  397. if (dataSource && [dataSource respondsToSelector:@selector(numberOfComponentsInPickerView:)]) {
  398. _numberOfComponents = [dataSource numberOfComponentsInPickerView:self];
  399. }
  400. }
  401. - (void)setTextColorOfSelectedRow:(UIColor *)textColorOfSelectedRow {
  402. _textColorOfSelectedRow = textColorOfSelectedRow;
  403. [self.columnViewList enumerateObjectsUsingBlock:^(PGPickerColumnView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  404. obj.textColorOfSelectedRow = textColorOfSelectedRow;
  405. }];
  406. }
  407. - (void)setTextColorOfOtherRow:(UIColor *)textColorOfOtherRow {
  408. _textColorOfOtherRow = textColorOfOtherRow;
  409. [self.columnViewList enumerateObjectsUsingBlock:^(PGPickerColumnView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  410. obj.textColorOfOtherRow = textColorOfOtherRow;
  411. }];
  412. }
  413. - (void)setLineBackgroundColor:(UIColor *)lineBackgroundColor {
  414. _lineBackgroundColor = lineBackgroundColor;
  415. [self.upLines enumerateObjectsUsingBlock:^(UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  416. obj.backgroundColor = lineBackgroundColor;
  417. self.downLines[idx].backgroundColor = lineBackgroundColor;
  418. }];
  419. }
  420. #pragma mark - Getter
  421. - (NSUInteger)numberOfRows {
  422. if (!_numberOfRows) {
  423. if (self.dataSource && [self.dataSource respondsToSelector:@selector(pickerView:numberOfRowsInComponent:)]) {
  424. _numberOfRows = [self.dataSource pickerView:self numberOfRowsInComponent:_numberOfComponents];
  425. }else {
  426. _numberOfRows = 0;
  427. }
  428. }
  429. return _numberOfRows;
  430. }
  431. - (NSMutableArray<NSNumber *> *)animationOfSelectedRowList {
  432. if (!_animationOfSelectedRowList) {
  433. _animationOfSelectedRowList = [NSMutableArray array];
  434. }
  435. return _animationOfSelectedRowList;
  436. }
  437. - (NSMutableArray<NSNumber *> *)numberOfSelectedRowList {
  438. if (!_numberOfSelectedRowList) {
  439. _numberOfSelectedRowList = [NSMutableArray array];
  440. }
  441. return _numberOfSelectedRowList;
  442. }
  443. - (NSMutableArray<NSNumber *> *)numberOfSelectedComponentList {
  444. if (!_numberOfSelectedComponentList) {
  445. _numberOfSelectedComponentList = [NSMutableArray array];
  446. }
  447. return _numberOfSelectedComponentList;
  448. }
  449. @end