CLLocationCoordinate2D cordinate;
- (void)viewDidLoad {
[super viewDidLoad];
self.mapview.delegate=self;
self.locationManager.delegate = self
self.locationManager.distanceFilter = kCLDistanceFilterNone
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest
[self.mapview setMapType:MKMapTypeSatellite];
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 54, 122, 21)];
label.textAlignment = NSTextAlignmentCenter;
label.textColor = [UIColor whiteColor];
label.backgroundColor = [UIColor colorWithRed:0.0/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:0.3];
label.text = @"title";
//create our view for the image
UIImageView *coloredView1 = [[UIImageView alloc]initWithFrame:CGRectMake(7, 5.5, 122, 75)];
coloredView1.image = [UIImage imageNamed:@"demo.png"];
UIView *view1 = [[UIView alloc]initWithFrame:CGRectMake(7, 5.5, 122, 75)];
view1.backgroundColor = [UIColor clearColor];
[view1 addSubview:label];
[view1 addSubview:coloredView1];
//create our view for the background image
UIImageView *coloredView2 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0.0, 136, 110)];
coloredView2.image = [UIImage imageNamed:@"mapMarker"];
UIView *view2 = [[UIView alloc]initWithFrame:CGRectMake(7, 5.5, 122, 75)];
view1.backgroundColor = [UIColor clearColor];
[view2 addSubview:coloredView2];
[view2 addSubview:view1];
//create our view for the background image
UIView *view3 = [[UIView alloc]initWithFrame:CGRectMake(0, 0.0, 136, 200)];
view3.backgroundColor = [UIColor clearColor];
[view3 addSubview:view2];
SKAnnotationView *annotationView = [[SKAnnotationView alloc] initWithView:customAnnotationView reuseIdentifier:@"reusableIdentifier"];
SKAnnotation *annotation = [SKAnnotation annotation];
annotation.identifier = 123456;
annotation.location = region.center;
annotation.annotationView = annotationView;
[self.mapView addAnnotation:annotation withAnimationSettings:[SKAnimationSettings animationSettings]];
}
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
if([annotation isKindOfClass:[MKUserLocation class]])
{
return nil;
}
static NSString *identifier = @"myAnnotation";
DraggableAnnotationView * annotationView = (DraggableAnnotationView *)[self.mapview dequeueReusableAnnotationViewWithIdentifier:identifier];
if (!annotationView)
{
annotationView = [[DraggableAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
annotationView.image = [UIImage imageNamed:@"ic_map_pin.png"];
}
else
{
annotationView.annotation = annotation;
}
annotationView.delegate = self;
return annotationView;
}
あなたのために役立つ、このコードは、その後、あなたの投票を与える場合は事前のおかげで...あなたに
に感謝します