- (void)viewDidLoad {
[super viewDidLoad];
/* MapView. */
self.mapView = [[HMapView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.frame), CGRectGetHeight(self.view.frame) - CGRectGetMinY(self.navigationController.navigationBar.frame))];
self.mapView.delegate = self;
self.mapView.centerCoordinate = CLLocationCoordinate2DMake(48.893478, 2.334595);
[self.view addSubview:self.mapView];
self.mapView.showsScale = false;
} |
|
- (void)viewDidLoad {
[super viewDidLoad];
/* Zoom enabled. */
self.mapView.zoomEnabled = true;
/* Scroll enabled. */
self.mapView.scrollEnabled = true;
/* Rotate enabled. */
self.mapView.rotateEnabled = true;
/* Overlooking enabled. */
self.mapView.overlookingEnabled = true;
} |
|
- (void)viewDidLoad {
[super viewDidLoad];
/* Annotation. */
CLLocationCoordinate2D position = CLLocationCoordinate2DMake(48.893478, 2.334595);
HPointAnnotation *annotation = [[HPointAnnotation alloc] init];
annotation.coordinate = position;
annotation.title = @"Hello Huawei Map";
annotation.subtitle = @"This is a subtitle!";
[self.mapView addAnnotation:annotation];
}
- (HAnnotationView *)mapView:(HMapView *)mapView viewForAnnotation:(id<HAnnotation>)annotation
{
if ([annotation isKindOfClass:[HPointAnnotation class]])
{
HPinAnnotationView *annotationView = [[HPinAnnotationView alloc] init];
annotationView.canShowCallout = YES;
return annotationView;
}
return nil;
} |
|
- (void)viewDidLoad {
[super viewDidLoad];
/* Polygon. */
CLLocationCoordinate2D coordinates[4];
coordinates[0].latitude = 48.993478;
coordinates[0].longitude = 2.234595;
coordinates[1].latitude = 48.993478;
coordinates[1].longitude = 2.434595;
coordinates[2].latitude = 48.793478;
coordinates[2].longitude = 2.434595;
coordinates[3].latitude = 48.793478;
coordinates[3].longitude = 2.234595;
HPolygon *polygon = [[HPolygon alloc] initWithWithCoordinates:coordinates count:4];
[self.mapView addOverlay:polygon];
}
- (HOverlayView *)mapView:(HMapView *)mapView viewForOverlay:(id<HOverlay>)overlay
{
if ([overlay isKindOfClass:[HPolygon class]])
{
HPolygonView *polygonView = [[HPolygonView alloc] initWithPolygon:overlay];
polygonView.lineWidth = 3;
polygonView.strokeColor = [UIColor colorWithRed:.2 green:.1 blue:.1 alpha:.8];
polygonView.fillColor = [[UIColor redColor] colorWithAlphaComponent:0.2];
return polygonView;
}
return nil;
} |
|