Skip to content

maximbilan/iOS-Frequency-Table

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iOS Frequency Table

A frequency simple table control.


alt tag

Installation

Add the next source files to your project:

FrequencyTable.h
FrequencyTable.m

Using

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];