A frequency simple table control.
Add the next source files to your project:
FrequencyTable.h FrequencyTable.m
You can add view in the Interface Builder and set a class to FrequencyTable or create in the code:
FrequencyTable *frequencyTable = [[FrequencyTable alloc] initWithPositionWithX:0
withY:0
isWideScreen:YES];
[self.view addSubview:frequencyTable];
For adding table data, you can use the following code:
NSMutableArray *array = [[NSMutableArray alloc] init];
float total = 0.0;
for (NSInteger i = 0; i < 50; ++i) {
FrequencyTableRecord *record = [[FrequencyTableRecord alloc] init];
record.name = [NSString stringWithFormat:@"Item %d", i];
record.value = RAND_FROM_TO(1, 500);
total += record.value;
[array addObject:record];
}
[self.frequencyTable setData:array withTotal:total];
