Skip to content

Commit 439ca73

Browse files
committed
Use custom table cell and localized chart titles
Import CustomTableViewCell and AAEasyTool; append descriptive Chinese suffixes to several chart title strings (separated by '---'). Implement tableView:cellForRowAtIndexPath: to dequeue CustomTableViewCell, configure accessory, numberLabel (text, rounded background color chosen from a 9-color palette via AAEasyTool), parse title/subtitle from the updated strings, and apply alternating row background colors.
1 parent a11f46d commit 439ca73

File tree

1 file changed

+39
-4
lines changed

1 file changed

+39
-4
lines changed

AAChartKitDemo/Demo/AAChartListVC/AAChartModelListVC.m

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#import "MixedChartVC.h"
1414
#import "CustomStyleForScatterChartVC.h"
1515
#import "CustomStyleForBubbleChartVC.h"
16+
#import "CustomTableViewCell.h"
17+
#import "AAEasyTool.h"
1618

1719
@interface AAChartModelListVC ()
1820

@@ -144,20 +146,53 @@ - (void)viewDidLoad {
144146

145147
/*Custom Style For Scatter Chart*/
146148
@[
147-
@"customScatterChartMarkerSymbolContent",
148-
@"drawLineMixedScatterChartWithPointsCoordinates2",
149+
@"customScatterChartMarkerSymbolContent---自定义散点图的标志点内容",
150+
@"drawLineMixedScatterChartWithPointsCoordinates2---通过点坐标绘制折线混合散点图",
149151
],
150152
/*Custom Style For Bubble Chart*/
151153
@[
152-
@"negativeColorMixedBubbleChart",
153-
@"showAARadialGradientPositionAllEnumValuesWithBubbleChart",
154+
@"negativeColorMixedBubbleChart---基准线以下异色混合气泡图",
155+
@"showAARadialGradientPositionAllEnumValuesWithBubbleChart---气泡图径向渐变位置枚举示例",
154156
],
155157
];
156158

157159
self.view.backgroundColor = [UIColor whiteColor];
158160
[self setUpMainTableView];
159161
}
160162

163+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
164+
CustomTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CustomTableViewCell"];
165+
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
166+
167+
cell.numberLabel.text = [NSString stringWithFormat:@"%ld", indexPath.row + 1];
168+
cell.numberLabel.layer.masksToBounds = true;
169+
cell.numberLabel.layer.cornerRadius = 10;
170+
UIColor *numBgColor = [AAEasyTool colorWithHexString:@[@"#5470c6",
171+
@"#91cc75",
172+
@"#fac858",
173+
@"#ee6666",
174+
@"#73c0de",
175+
@"#3ba272",
176+
@"#fc8452",
177+
@"#9a60b4",
178+
@"#ea7ccc"][indexPath.section % 9]];
179+
cell.numberLabel.backgroundColor = numBgColor;
180+
cell.numberLabel.textColor = UIColor.whiteColor;
181+
182+
NSString *textStr = self.chartTypeTitleArr[(NSUInteger)indexPath.section][(NSUInteger)indexPath.row];
183+
NSArray<NSString *> *textStrArr = [textStr componentsSeparatedByString:@"---"];
184+
cell.titleLabel.text = textStrArr.firstObject;
185+
cell.subtitleLabel.text = textStrArr.count > 1 ? textStrArr[1] : @"";
186+
187+
if (indexPath.row % 2 == 0) {
188+
cell.backgroundColor = [AAEasyTool colorWithHexString:@"#FFF0F5"];
189+
} else {
190+
cell.backgroundColor = UIColor.whiteColor;
191+
}
192+
193+
return cell;
194+
}
195+
161196
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
162197
NSUInteger row = (NSUInteger) indexPath.row;
163198
NSUInteger section = (NSUInteger) indexPath.section;

0 commit comments

Comments
 (0)