MapView,我该如何改变距离?

时间:2016-05-16 13:53:31

标签: ios mkmapview

在mapview中,如何将其从A更改为B,如图所示?

以下是代码:

#define BE_Latitude 25.9444055
#define BE_longtitude -80.1229769

#define BEMSpan 0.100f;

Picture

EDITED

代码

#import "BEViewController.h"
#import "BENSObject.h"

@interface BEViewController ()

@end


#define BE_Latitude 25.9444055
#define BE_longtitude -80.1229769

#define BEMSpan 0.100f;

@implementation BEViewController
@synthesize BEMapView;

- (void)viewDidLoad {
    [super viewDidLoad];

    MKCoordinateRegion BERegion;

    //Center
    CLLocationCoordinate2D center;
    center.latitude = BE_Latitude;
    center.longitude = BE_longtitude;

    //Span
    MKCoordinateSpan span;
    span.latitudeDelta = BE_Latitude;
    span.longitudeDelta = BE_longtitude;

    BERegion.center = center;
    BERegion.span = span;

    //Set our map
    [BEMapView setRegion:BERegion animated:YES];


    CLLocationCoordinate2D BELocation;
    BELocation.latitude = BE_Latitude;
    BELocation.longitude = BE_longtitude;

    BENSObject * BEAnnitation = [[BENSObject alloc] init];
    BEAnnitation.coordinate = BELocation;
    BEAnnitation.title = @“C”;
    BEAnnitation.subtitle = @“D”;


    {[self.BEMapView addAnnotation:BEAnnitation];

    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end

1 个答案:

答案 0 :(得分:0)

要更改要调整MKCoordinateSpan的缩放级别。 Apple Docs on MapKit Data Types会在这里提供帮助。

您当前正在使用latitudeDelta和longitudeDelta的位置坐标。