(Использование iOS 5 и Xcode 4.2)
У меня есть MKMapView и вы хотите нарисовать круг радиуса 1000 м вокруг местоположения пользователя.
На первый взгляд кажется, что реализация mapView: viewForAnnotation: метода отображения вида карты и добавление пользовательского MKAnnotationView для местоположения пользователей, было бы идеальным решением. Он будет выглядеть примерно так:
- (MKAnnotationView *)mapView:(MKMapView *)mapView
viewForAnnotation:(id <MKAnnotation>)annotation
{
// If it the user location, return my custom MKAnnotationView.
if ([annotation isKindOfClass:[MKUserLocation class]]) {
return myCustomAnnotationView;
} else {
return nil;
}
}
Однако аннотации на карте не масштабируются при увеличении и удалении карты.
Итак, я попробовал добавить наложение (потому что накладывал масштаб с помощью карты), используя класс MKCircle и установив его координаты последние координаты с моего делегата locationManger/map view. Однако, поскольку свойство координат MKCircle выполняется только для чтения, мне нужно удалить оверлей, а затем добавить новый каждый раз, когда пользователь перемещается. Вызывает заметное мерцание, как это бывает.
Есть ли способ сделать шкалу аннотаций легко, так как масштабирование и изменение масштаба карты? Или есть хороший способ сделать плавный переход с изменениями в местоположении пользователей?
Буду очень признателен вам за помощь:)