Files
MapLibreParticleLab/platform/ios/app/MBXAnnotationView.m
Jesse Bounds d9c6181f34 [ios] Add annotation container view (#5194)
Add a container view to hold annotations. This gets around a performance
issue with `UIView:addSubview:` where adding views is N^2. It helps
annotation views avoid cutting into callout views when the annotation
views are transformed to be "flat".
2016-06-01 17:36:07 -07:00

29 lines
686 B
Objective-C

#import "MBXAnnotationView.h"
@interface MBXAnnotationView ()
@property (nonatomic) UIView *centerView;
@end
@implementation MBXAnnotationView
- (void)layoutSubviews {
[super layoutSubviews];
if (!self.centerView) {
self.backgroundColor = [UIColor blueColor];
self.centerView = [[UIView alloc] initWithFrame:CGRectInset(self.bounds, 1.0, 1.0)];
self.centerView.backgroundColor = self.centerColor;
[self addSubview:self.centerView];
}
}
- (void)setCenterColor:(UIColor *)centerColor {
if (![_centerColor isEqual:centerColor]) {
_centerColor = centerColor;
self.centerView.backgroundColor = centerColor;
}
}
@end