Files
MapLibreParticleLab/platform/ios/src/MGLCompactCalloutView.m
Minh Nguyễn 11d99bd890 [ios] Refined custom callout view support
Renamed MGLCalloutView to MGLCompactCalloutView and MGLCalloutViewProtocol to MGLCalloutView to avoid an awkward workaround for a Swift name collision. Replaced individual title and subtitle properties with a single representedObject property that lets you use custom annotation properties in the custom callout view. Overrode a problematic SMCalloutView method. Added lots more documentation.
2016-01-06 23:43:07 -08:00

32 lines
655 B
Objective-C

#import "MGLCompactCalloutView.h"
#import "MGLAnnotation.h"
@implementation MGLCompactCalloutView
{
id <MGLAnnotation> _representedObject;
}
@synthesize representedObject = _representedObject;
+ (instancetype)platformCalloutView
{
return [[self alloc] init];
}
- (void)setRepresentedObject:(id <MGLAnnotation>)representedObject
{
_representedObject = representedObject;
if ([representedObject respondsToSelector:@selector(title)])
{
self.title = representedObject.title;
}
if ([representedObject respondsToSelector:@selector(subtitle)])
{
self.subtitle = representedObject.subtitle;
}
}
@end