4d8bbdc7ef
Add to Git the current app version (the same available in the OriginalZip folder)
51 lines
1.2 KiB
Objective-C
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
|