You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
swiftui에서 mapkit을 사용중인데 사용자의 현재 위치에서 annotation을 사용하는것은 가능하나, 위치가 변경될 시 annotation이 기존 위치에서 찍히고 변경된 위치에서 찍히지 않음
user location button은 작동하지만 map rotation, 3d 코드를 써도 작동이 안됨
원인
.onAppear {
if let userLocation = locationManager.location, !isRegionSet {
region = MKCoordinateRegion(center: userLocation.coordinate, span: MKCoordinateSpan(latitudeDelta: 0.05, longitudeDelta: 0.05))
baseLocation = userLocation.coordinate
isRegionSet = true // 초기 위치가 설정되었음을 표시
}
}
.onChange(of: locationManager.location) { newLocation in
if let newLocation = newLocation, !isRegionSet {
region = MKCoordinateRegion(center: newLocation.coordinate, span: MKCoordinateSpan(latitudeDelta: 0.05, longitudeDelta: 0.05))
baseLocation = newLocation.coordinate
isRegionSet = true // 초기 위치가 설정되었음을 표시
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
현상
swiftui에서 mapkit을 사용중인데 사용자의 현재 위치에서 annotation을 사용하는것은 가능하나, 위치가 변경될 시 annotation이 기존 위치에서 찍히고 변경된 위치에서 찍히지 않음
user location button은 작동하지만 map rotation, 3d 코드를 써도 작동이 안됨
원인
시도
을 하면 변경되는 위치에는 찍히지만, 지도 이동이 불가해짐
Beta Was this translation helpful? Give feedback.
All reactions