56 lines
1.4 KiB
Objective-C
56 lines
1.4 KiB
Objective-C
//
|
|
// EQNMapAnnotationSeismicNetwork.m
|
|
// Earthquake Network
|
|
//
|
|
// Refactored by Andrea Busi
|
|
// Copyright © 2021 Earthquake Network. All rights reserved.
|
|
//
|
|
|
|
#import "EQNMapAnnotationSeismicNetwork.h"
|
|
|
|
@implementation EQNMapAnnotationSeismicNetwork
|
|
|
|
#pragma mark - Init
|
|
|
|
- (instancetype)initWithTitle:(NSString *)title location:(CLLocationCoordinate2D )coordinate magnitudo:(NSInteger)magnitude
|
|
{
|
|
self = [super init];
|
|
if (self) {
|
|
_title = title;
|
|
_coordinate = coordinate;
|
|
_magnitude = magnitude;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
#pragma mark - Public
|
|
|
|
- (MKAnnotationView *)annotationView
|
|
{
|
|
MKAnnotationView *annotationView = [[MKAnnotationView alloc] initWithAnnotation:self reuseIdentifier:EQNMapAnnotationSeismicNetworkIdentifier];
|
|
annotationView.enabled = YES;
|
|
annotationView.canShowCallout = YES;
|
|
|
|
NSString *imageString;
|
|
switch (self.magnitude) {
|
|
case 1:
|
|
imageString = @"star_green";
|
|
break;
|
|
case 2:
|
|
imageString = @"star_yellow";
|
|
break;
|
|
case 3:
|
|
imageString = @"star_red1";
|
|
break;
|
|
default:
|
|
imageString = @"";
|
|
break;
|
|
}
|
|
|
|
annotationView.image = [UIImage imageNamed:imageString];
|
|
annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
|
|
return annotationView;
|
|
}
|
|
|
|
@end
|