|
|
|
@ -140,8 +140,10 @@
@@ -140,8 +140,10 @@
|
|
|
|
|
- (void)topViewShowAndHidden:(NSInteger)isShow |
|
|
|
|
{ |
|
|
|
|
self.topView.hidden = isShow == 1 ? NO : YES; |
|
|
|
|
// CGFloat yy = iPhoneX_NavHeight+Adapted(50)+0.5; |
|
|
|
|
[UIView animateWithDuration:0.5 animations:^{ |
|
|
|
|
self.topView.frame = CGRectMake(0,isShow == 1 ? 0 : -Adapted(55), SCREEN_WIDTH, Adapted(55)); |
|
|
|
|
// self.mapView.frame = CGRectMake(0, self.topView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-yy-Adapted(55)); |
|
|
|
|
} completion:^(BOOL finished) { |
|
|
|
|
|
|
|
|
|
}]; |
|
|
|
@ -177,11 +179,14 @@
@@ -177,11 +179,14 @@
|
|
|
|
|
- (void)loadWithInfoTrack:(NSMutableArray *)mapPoints |
|
|
|
|
{ |
|
|
|
|
// self.startAndStopBtn.selected = NO; |
|
|
|
|
// [self startAndStopBtnAction:self.startAndStopBtn]; |
|
|
|
|
|
|
|
|
|
mapPoints = (NSMutableArray *)[[mapPoints reverseObjectEnumerator] allObjects]; |
|
|
|
|
[self startAndStopBtnAction:self.startAndStopBtn]; |
|
|
|
|
[self.mapView removeAnnotations:self.pointAnnotationArr]; |
|
|
|
|
[self.mapView removeOverlay:self.routeLine]; |
|
|
|
|
[self.trackView removeFromSuperview]; |
|
|
|
|
self.trackView = nil; |
|
|
|
|
self.currentIndex = 0; |
|
|
|
|
self.routeLine = nil; |
|
|
|
|
self.routeLineView = nil; |
|
|
|
|
self.pointAnnotationArr = nil; |
|
|
|
@ -195,16 +200,18 @@
@@ -195,16 +200,18 @@
|
|
|
|
|
self.pathPoints = nil; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[self addLocate:mapPoints]; |
|
|
|
|
if(mapPoints.count > 1) |
|
|
|
|
{ |
|
|
|
|
self.startAndStopBtn.selected = YES; |
|
|
|
|
[self startAndStopBtnAction:self.startAndStopBtn]; |
|
|
|
|
} |
|
|
|
|
//默认选中 起点 |
|
|
|
|
CustomAnnotationView *tempView = [CustomAnnotationView new]; |
|
|
|
|
tempView.annotation = self.pointAnnotationArr.lastObject; |
|
|
|
|
[self mapView:self.mapView didSelectAnnotationView:tempView]; |
|
|
|
|
AfterDispatch(0.2, ^{ |
|
|
|
|
[self addLocate:mapPoints]; |
|
|
|
|
if(mapPoints.count > 1) |
|
|
|
|
{ |
|
|
|
|
self.startAndStopBtn.selected = YES; |
|
|
|
|
[self startAndStopBtnAction:self.startAndStopBtn]; |
|
|
|
|
} |
|
|
|
|
//默认选中 起点 |
|
|
|
|
CustomAnnotationView *tempView = [CustomAnnotationView new]; |
|
|
|
|
tempView.annotation = self.pointAnnotationArr.lastObject; |
|
|
|
|
[self mapView:self.mapView didSelectAnnotationView:tempView]; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -236,7 +243,7 @@
@@ -236,7 +243,7 @@
|
|
|
|
|
[self.mapView addAnnotations:self.pointAnnotationArr]; |
|
|
|
|
} |
|
|
|
|
// [sender setSelected:!sender.isSelected]; |
|
|
|
|
self.mapView.userInteractionEnabled = sender.isSelected; |
|
|
|
|
// self.mapView.userInteractionEnabled = sender.isSelected; |
|
|
|
|
} |
|
|
|
|
#pragma mark - 构造shapeLayer |
|
|
|
|
- (void)initShapeLayerWithPath:(CGPathRef)path |
|
|
|
@ -325,10 +332,10 @@
@@ -325,10 +332,10 @@
|
|
|
|
|
[self.headView.layer removeFromSuperlayer]; |
|
|
|
|
self.startAndStopBtn.selected = NO; |
|
|
|
|
[self.startAndStopBtn setImage:ImageName_(@"icon_start") forState:UIControlStateNormal]; |
|
|
|
|
// if(!self.startAndStopBtn.isSelected) |
|
|
|
|
// { |
|
|
|
|
// [self startAndStopBtnAction:self.startAndStopBtn]; |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
[self.trackView removeFromSuperview]; |
|
|
|
|
self.trackView = nil; |
|
|
|
|
[self.mapView addAnnotations:self.pointAnnotationArr]; |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -337,17 +344,24 @@
@@ -337,17 +344,24 @@
|
|
|
|
|
nextAnim.delegate = self; |
|
|
|
|
// [self.headView addAnimation:nextAnim forKey:[NSString stringWithFormat:@"headPosition%d",currentIndex]]; |
|
|
|
|
[self.headView.layer addAnimation:nextAnim forKey:@"headPosition"]; |
|
|
|
|
if(self.pathPoints){ |
|
|
|
|
if(self.pathPoints) |
|
|
|
|
{ |
|
|
|
|
CGPoint currentPoint = self.pathPoints[self.currentIndex]; |
|
|
|
|
if (self.currentIndex == 0){ |
|
|
|
|
if (self.currentIndex == 0) |
|
|
|
|
{ |
|
|
|
|
//第一 |
|
|
|
|
[self addTrackViewPoint:currentPoint Type:0 Angle:0]; |
|
|
|
|
double angle = self.angeleValues[self.angeleValues.count-1].doubleValue; |
|
|
|
|
self.headView.transform = CGAffineTransformMakeRotation(angle); |
|
|
|
|
}else if(self.currentIndex == self.pointAnnotationArr.count-1){ |
|
|
|
|
} |
|
|
|
|
else if(self.currentIndex == self.pointAnnotationArr.count-1) |
|
|
|
|
{ |
|
|
|
|
//最后一个 |
|
|
|
|
[self addTrackViewPoint:currentPoint Type:2 Angle:0]; |
|
|
|
|
}else{ |
|
|
|
|
self.mapView.userInteractionEnabled = YES; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
NSInteger tempIndex = self.angeleValues.count-self.currentIndex-1; |
|
|
|
|
if(tempIndex < 0){ |
|
|
|
|
tempIndex = 0; |
|
|
|
@ -833,13 +847,13 @@
@@ -833,13 +847,13 @@
|
|
|
|
|
{ |
|
|
|
|
if (!_mapView) |
|
|
|
|
{ |
|
|
|
|
CGFloat yy = iPhoneX_NavHeight+Adapted(50)+0.5; |
|
|
|
|
_mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-yy)]; |
|
|
|
|
CGFloat yy = iPhoneX_NavHeight+Adapted(50)+0.5+Adapted(55); |
|
|
|
|
_mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, Adapted(55), SCREEN_WIDTH, SCREEN_HEIGHT-yy)]; |
|
|
|
|
MKCoordinateSpan span = MKCoordinateSpanMake(0.021251, 0.016093); |
|
|
|
|
CLLocationCoordinate2D center = self.mapView.region.center; |
|
|
|
|
[_mapView setRegion:MKCoordinateRegionMake(center, span) animated:YES]; |
|
|
|
|
_mapView.rotateEnabled = NO; |
|
|
|
|
_mapView.userInteractionEnabled = NO; |
|
|
|
|
_mapView.userInteractionEnabled = YES; |
|
|
|
|
_mapView.delegate = self; |
|
|
|
|
} |
|
|
|
|
return _mapView; |
|
|
|
|