Vẽ một marker
Tạo một marker mặc định gồm một callout và tiêu đề bằng cách sử dụng Vietbando iOS SDK.
#import "ViewController.h"
@import Vietbando;
@interface ViewController () <VBDMapViewDelegate>
@property (nonatomic) VBDMapView *mapView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
VBDMapView *mapView = [[VBDMapView alloc] initWithFrame:self.view.bounds];
mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
// Set the map's center coordinates and zoom level
[mapView setCenterCoordinate:CLLocationCoordinate2DMake(10.7763973, 106.701278)
zoomLevel:12
animated:NO];
[self.view addSubview:mapView];
// Set the delegate property of our map view to self after instantiating it.
mapView.delegate = self;
// Declare the marker `hello` and set its coordinates, title, and subtitle
VBDPointAnnotation *hello = [[VBDPointAnnotation alloc] init];
hello.coordinate = CLLocationCoordinate2DMake(10.7763973, 106.701278);
hello.title = @"Hello world!";
hello.subtitle = @"Welcome to my marker";
// Add marker `hello` to the map
[mapView addAnnotation:hello];
}
// Use the default marker; see our custom marker example for more information
- (VBDAnnotationImage *)mapView:(VBDMapView *)mapView imageForAnnotation:(id <VBDAnnotation>)annotation {
return nil;
}
// Allow markers callouts to show when tapped
- (BOOL)mapView:(VBDMapView *)mapView annotationCanShowCallout:(id <VBDAnnotation>)annotation {
return YES;
}
@end