Làm động camera bản đồ

Hành trình camera động.

#import "ViewController.h"
@import Vietbando;

@interface ViewController () <VBDMapViewDelegate>

@property (nonatomic) VBDMapView *mapView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.mapView = [[VBDMapView alloc] initWithFrame:self.view.bounds];
    self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    self.mapView.delegate = self;    

    CLLocationCoordinate2D center = CLLocationCoordinate2DMake(10.7763973, -106.701278);

    // Optionally set a starting point.
    [self.mapView setCenterCoordinate:center zoomLevel:0 direction:0 animated:NO];

    [self.view addSubview:self.mapView];
}

-(void)mapViewDidFinishLoadingMap:(VBDMapView *)mapView {
    // Wait for the map to load before initiating the first camera movement.

    // Create a camera that rotates around the same center point, rotating 180°.
    // `fromDistance:` is meters above mean sea level that an eye would have to be in order to see what the map view is showing.
    VBDMapCamera *camera = [VBDMapCamera cameraLookingAtCenterCoordinate:self.mapView.centerCoordinate fromDistance:4500 pitch:15 heading:180];

    // Animate the camera movement over 5 seconds.
    [self.mapView setCamera:camera withDuration:5 animationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
}

@end