IBHeatMap 是 iOS 上一个简单易用的(虽然有点慢)热图生成器。它只需要点、半径和颜色,就可以在您想要的内容上生成热图。
IB HeatMap 具有以下属性
@property (nonatomic, strong) id<IBHeatMapDelegate> delegate;
一个按升序排列颜色的数组。
@property (nonatomic, strong) NSArray *colors;
一个包含所有点的数组,值为从 0 到 1 的相对值(在 XX 和 YY 轴上以 CGPoints 在 NSValues 中表示)。
@property (nonatomic, strong) NSArray *points;
最后是一个用于影响点半径的 CGFloat 值。
@property (nonatomic, assign) CGFloat pointRadius;
代理实现了一个在热图生成完成时通知用户的方法。这应该有助于用户提供生成时的加载器。
- (void)heatMapFinishedLoading;
视图应由代码或 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];
您可以为地图完成的生成分配一个代理。
self.heatMap.delegate = self;
通过实现以下功能
-(void)heatMapFinishedLoading {
NSLog(@"FinishedLoadingHeatMap");
}