{
NSLog(@"ddddddd");
/*
locationManager=[[CLLocationManager alloc] init];
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
locationManager.delegate=self;
//Start the compass updates.
[locationManager startUpdatingHeading];
[[self locationManager] startUpdatingHeading];
[[self locationManager] startUpdatingLocation];
*/
[mapView setMapType:MKMapTypeStandard];
[mapView setZoomEnabled:YES];
[mapView setScrollEnabled:YES];
MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = 1.30;//41.902245099708516;
region.center.longitude = 103.8;//12.457906007766724;
region.span.longitudeDelta = 0.01f;
region.span.latitudeDelta = 0.01f;
[mapView setRegion:region animated:YES];
[mapView setDelegate:self];
MyAnnotation *ann = [[MyAnnotation alloc] init];
ann.title = @"Rome";
ann.subtitle = @"San Peter";
ann.coordinate = region.center;
//[mapView addAnnotation:ann];
/// one more annt
//My own Annotation
MKCoordinateRegion SecondRegion;
SecondRegion.center.latitude = 1.301;
SecondRegion.center.longitude = 103.81;
MyAnnotation *aSecondAnnotation = [[MyAnnotation alloc] init];
aSecondAnnotation.title = @"Second Annotation";
//By the way, this line doesn’t work, everything is still in the same line :(
aSecondAnnotation.subtitle = @"clerqkey";
aSecondAnnotation.coordinate = SecondRegion.center;
//// 2 more
MKCoordinateRegion SecondRegiona;
SecondRegiona.center.latitude = 1.31;
SecondRegiona.center.longitude = 103.9;
MyAnnotation *aSecondAnnotationa = [[MyAnnotation alloc] init];
aSecondAnnotationa.title = @"3rd Annotation";
//By the way, this line doesn’t work, everything is still in the same line :(
aSecondAnnotationa.subtitle = @"ret";
aSecondAnnotationa.coordinate = SecondRegiona.center;
//////////////////////////////////////////////////////////////////////////////////////////////
NSArray *Annotations = [NSArray arrayWithObjects:ann,aSecondAnnotation,aSecondAnnotationa,nil];
[mapView addAnnotations:Annotations];
[super viewDidLoad];
}/*
- (void)locationManager:(CLLocationManager *) manager didUpdateHeading:(CLHeading *) newHeading {
NSLog(@"55555555555555555555555");
NSLog(@"New magnetic heading: %f", newHeading.magneticHeading);
NSLog(@"New true heading: %f", newHeading.trueHeading);
}
*/
- (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView
{
for (id currentAnnotation in mapView.annotations) {
[mapView selectAnnotation:currentAnnotation animated:YES];
}
}
- (MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id
{
MKPinAnnotationView *pinView = nil;
[[self locationManager] startUpdatingHeading];
if(annotation != mapView.userLocation)
{
static NSString *defaultPinID = @"com.invasivecode.pin";
pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if ( pinView == nil )
pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:defaultPinID] autorelease];
pinView.pinColor = MKPinAnnotationColorPurple;
pinView.canShowCallout = YES;
pinView.animatesDrop = YES;
}
else
{
[mapView.userLocation setTitle:@"I am here"];
}
return pinView;
}