IBHeatMap 1.0

IBHeatMap 1.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Ivan Bruel.



  • By
  • Ivan Bruel

sample

Purpose

IBHeatMap is a simple to use (although a bit slow) HeatMap generator for iOS. All it is required are points, radius and colors and it will generate a HeatMap on top of your desired content.

Properties

The IBHEatMap has the following properties:

@property (nonatomic, strong) id<IBHeatMapDelegate> delegate;

An array that contains the colors in order of ascending order.

@property (nonatomic, strong) NSArray *colors;

An array that contains all the points with relative values ranging from 0 to 1 (in both XX and YY axis as CGPoints in NSValues).

@property (nonatomic, strong) NSArray *points;

And finally a CGFloat value for the point radius of impact.

@property (nonatomic, assign) CGFloat pointRadius;

Delegate

Delegate implements a method to be notified when the heatmap finishes being generated. This should help users provide loaders for when it is being generated.

- (void)heatMapFinishedLoading;

Example

The view should be generated by code or by XIB.

self.heatMap = [[IBHeatMap alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds)) points:locations colors:@[[UIColor greenColor], [UIColor yellowColor], [UIColor redColor]] pointRadius:40.0f];

You can assign a delegate to know when the map finishes being generated.

self.heatMap.delegate = self;

And by implementing the following function

-(void)heatMapFinishedLoading {
  NSLog(@"FinishedLoadingHeatMap"); 
}