GMSGroundOverlay 애니메이션-CATiledLayer를 사용해야합니까?
iOS 용 Google지도 SDK 최신 버전 1.2.1.2944를 사용하여 GMSGroundOverlay
. 사용자는 이미지 시퀀스를 제어 할 수 있으므로 애니메이션을 사용하는 UIImage
것은 슬프게도 불가능하므로 UIImage
즉시 로드 하고 있습니다. 이 ( GMSGroundOverlay.icon
가) UIImage
업데이트중인로 설정되었습니다.
높은 메모리 사용량 외에도 1000px x 1000px 이상의 UIImage
사용 을 오버레이하려고 할 때마다 충돌이 발생한다는 한계에 부딪힌 것 같습니다 GMSGroundOverlay.icon
. UIImage
1000px x 1000px를 참조 하면 충돌이 발생합니다.
CATiledLayer
이미지를 처리하여 메모리에만로드 한 다음 아이콘 속성에로드하는 데 활용해야한다는 생각이 GMSGroundOverlay
들지만, CATiledLayer
iOS SDK 용 Google지도를 사용 하고 이미지를 애니메이션으로 시퀀싱 한 경험이있는 사람이 GMSGroundOverlay
있습니까?
pressanswer.com에서이 답변을 받았습니다. 도움이 될 것 같습니다.
현재는 애니메이션에 "위치"키 경로를 사용할 수 없으므로 "위도"및 "경도"키 경로를 별도로 사용하여 애니메이션을 적용했습니다.
먼저 점을 계산하고 위도 값 (y)과 경도 (x)에 대해 하나씩 두 개의 개별 배열에 추가 한 다음 CAKeyFrameAnimation의 values 속성을 사용하여 애니메이션을 적용합니다. CAKeyFrameAnimation 개체 2 개 (각 축당 1 개)를 만들고 CAAnimationGroup을 사용하여 그룹화하고 애니메이션을 적용하여 원을 만듭니다.
내 방정식에서 저는 타원형 경로를 생성 할 수 있도록 각 축의 반경 길이를 변경합니다.
NSMutableArray *latitudes = [NSMutableArray arrayWithCapacity:21];
NSMutableArray *longitudes = [NSMutableArray arrayWithCapacity:21];
for (int i = 0; i <= 20; i++) {
CGFloat radians = (float)i * ((2.0f * M_PI) / 20.0f);
// Calculate the x,y coordinate using the angle
CGFloat x = hDist * cosf(radians);
CGFloat y = vDist * sinf(radians);
// Calculate the real lat and lon using the
// current lat and lon as center points.
y = marker.position.latitude + y;
x = marker.position.longitude + x;
[longitudes addObject:[NSNumber numberWithFloat:x]];
[latitudes addObject:[NSNumber numberWithFloat:y]];
}
CAKeyframeAnimation *horizontalAnimation = [CAKeyframeAnimation animationWithKeyPath:@"longitude"];
horizontalAnimation.values = longitudes;
horizontalAnimation.duration = duration;
CAKeyframeAnimation *verticleAnimation = [CAKeyframeAnimation animationWithKeyPath:@"latitude"];
verticleAnimation.values = latitudes;
verticleAnimation.duration = duration;
CAAnimationGroup *group = [[CAAnimationGroup alloc] init];
group.animations = @[horizontalAnimation, verticleAnimation];
group.duration = duration;
group.repeatCount = HUGE_VALF;
[marker.layer addAnimation:group forKey:[NSString stringWithFormat:@"circular-%@",marker.description]];
'Programming' 카테고리의 다른 글
한때 마음에 들었던 프로그래밍 관행에 대해 마음이 바뀌 었습니까? (0) | 2020.08.19 |
---|---|
Linux에서 MbUnit, F # 프로젝트 내에서 사용됩니까? (0) | 2020.08.19 |
c2hs를 사용하여 구조체 및 익명 공용체와 인터페이스 (0) | 2020.08.19 |
MPI 타입 맵 표시 (0) | 2020.08.19 |
VC ++ 코드 DOM은 VS 애드온에서 액세스 할 수 있습니까? (0) | 2020.08.19 |