美文网首页
如何让MKMapView上的经纬度点全部显示在屏幕内?

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

作者: ZH0303 | 来源:发表于2020-03-13 14:22 被阅读0次

    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上的经纬度点全部显示在屏幕内?

          本文链接:https://www.haomeiwen.com/subject/tswhshtx.html