2012-05-24 81 views
1

我有一個帶有當前位置和一個MkPointAnnotation的MapKit。我需要跟蹤這些點之間的路線。MapKit:跟蹤路由

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    //esconder navBar 
    [[self navigationController] setNavigationBarHidden:YES animated:NO]; 

    mapView.showsUserLocation = YES; 
    UIBarButtonItem *zoomButton = [[UIBarButtonItem alloc] 
            initWithTitle: @"Onde Estou?" 
            style:UIBarButtonItemStylePlain 
            target: self 
            action:@selector(zoomIn:)]; 

    self.navigationItem.rightBarButtonItem = zoomButton; 

    UIBarButtonItem *typeButton = [[UIBarButtonItem alloc] 
            initWithTitle: @"Tipo" 
            style:UIBarButtonItemStylePlain 
            target: self 
            action:@selector(changeMapType:)]; 

    self.navigationItem.leftBarButtonItem = typeButton; 

    double lat = -21.21258; 
    double lng = -47.816802; 

    CLLocationCoordinate2D Coordinate; 

    Coordinate.latitude = lat; 
    Coordinate.longitude = lng; 

    MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init]; 
    annotationPoint.coordinate = Coordinate; 
    annotationPoint.title = @"Ribeirão Shopping"; 
    annotationPoint.subtitle = @"Ribeirão Preto - SP"; 
    [self.mapView addAnnotation:annotationPoint]; 

    MKCoordinateRegion newRegion; 
    newRegion.center.latitude = lat; 
    newRegion.center.longitude = lng; 
    [self.mapView setRegion:newRegion animated:YES]; 

    mapView.mapType = MKMapTypeStandard; 


} 

回答