如何让MKMapView上的经纬度点全部显示在屏幕内?

1.{


    CLLocationCoordinate2D oldCoordinate;


    BOOL_mapNeedsPadding;


    double_second;


    NSInteger_index;


    BOOL_isMoving;

}

2.- (void)viewDidLoad {

    [super viewDidLoad];


    self.titleLabel.text=@"作业信息";


//    [self.right setHidden:NO];

    [self.rightsetHidden:YES];

    [self.right setFrame:CGRectMake(self.navView.width - SCREEN_WIDTH/4 -20, StatusH , SCREEN_WIDTH/4, 44)];

    [self.right setImage:[UIImage imageNamed:@"NewFarmMachineryTrack"] forState:UIControlStateNormal];

    [self.right setTitle:@"轨迹明细" forState:UIControlStateNormal];

    [self.right setTitleColor:mainColor forState:UIControlStateNormal];

    [self.right setImageEdgeInsets:UIEdgeInsetsMake(0, -5, 0, 5)];


    _currentTimeStamp = [[ToolHelper getCurrentTimesp] doubleValue];

    self.currentDate = [self timeWithTimeIntervalString4:_currentTimeStamp];


    self.titleArray = [NSArray arrayWithObjects:@"x0.5",@"x1",@"x2",@"x4", nil];


    self.dataArray = [NSMutableArray arrayWithCapacity:0];


    self.pointArray = [NSMutableArray arrayWithCapacity:0];


    _mapNeedsPadding = NO;

3.dispatch_async(dispatch_get_main_queue(), ^{


            [self.mapViewaddAnnotations:self.pointArray];


            self->_mapNeedsPadding=YES;

            [self.mapView showAnnotations:self.pointArray animated:YES];


            [self.mapViewaddOverlay:self.polyline];


            [self.mapView addAnnotation:self.moveAnnotation];

        });

4.- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated{

    if(_mapNeedsPadding){

        _mapNeedsPadding = NO;

        [self.mapView setVisibleMapRect:self.mapView.visibleMapRect edgePadding:UIEdgeInsetsMake(0, 0, 0, 0) animated:YES];

    }

}

你可能感兴趣的:(如何让MKMapView上的经纬度点全部显示在屏幕内?)