Files
eqn.ios/Sources/Earthquake Network/model/annotation/SismaAnnotation.m
T
Andrea Busi 4d8bbdc7ef Production version
Add to Git the current app version (the same available in the OriginalZip folder)
2020-07-24 15:33:53 +02:00

51 lines
1.2 KiB
Objective-C

//
// SismaAnnotation.m
// Earthquake Network
//
// Created by Luca Beretta on 08/11/18.
// Copyright © 2018 Luca Beretta. All rights reserved.
//
#import "SismaAnnotation.h"
@implementation SismaAnnotation
-(id)initWithTitle:(NSString *)title location:(CLLocationCoordinate2D )coordinate intensita:(double)magnitude{
self = [super init];
if (self) {
_title = title;
_coordinate = coordinate;
_magnitude = magnitude;
}
return self;
}
-(MKAnnotationView *)annotationView{
MKAnnotationView *annotationView = [[MKAnnotationView alloc] initWithAnnotation:self reuseIdentifier:IDENTIFIER_ANNOTATION_SISMI];
annotationView.enabled = YES;
annotationView.canShowCallout = YES;
NSString *imageString;
NSLog(@"magnitudo %f", self.magnitude);
if(self.magnitude > 4.0){
imageString = @"dyamond_red";
}else if (self.magnitude < 3.0){
imageString = @"dyamond_green";
}else{
imageString = @"dyamond_yellow";
}
annotationView.image = [UIImage imageNamed:imageString];
annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
return annotationView;
}
@end