mkannotationview

How to rotate custom userLocationAnnotationView image using MapKit in swift?

好久不见. 提交于 2019-11-30 23:10:30
I'm trying to find a way to show the direction of the user on the map using MapKit. The native MapKit way to do that always rotate the entire map. Since user position is also an MKAnnotationView, I decided to create a specific class to override it and use a specific image (with an arrow). class UserLocationAnnotationView: MKAnnotationView { override init(frame: CGRect) { super.init(frame: frame) } override init(annotation: MKAnnotation!, reuseIdentifier: String!) { super.init(annotation: annotation, reuseIdentifier: reuseIdentifier) var frame = self.frame frame.size = CGSizeMake(130, 130) self

MKMapview annotation dynamic pin image changes after zooming

纵然是瞬间 提交于 2019-11-30 21:15:10
I am working on a little project that shows 7 different types of annotations on the map. My annotations are taken from a url result in array and I parse it using JSON. I have lots of annotations and everything seems to look good once the map loads. After zooming in and zooming out, the the pin images changes for some reason to the wrong pin image (a specific image, no clue why). I am sure I am missing something here...may you please help :) ? Here's one part of my code, let me know if you need anymore of it: -(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>

How to rotate custom userLocationAnnotationView image using MapKit in swift?

∥☆過路亽.° 提交于 2019-11-30 18:10:50
问题 I'm trying to find a way to show the direction of the user on the map using MapKit. The native MapKit way to do that always rotate the entire map. Since user position is also an MKAnnotationView, I decided to create a specific class to override it and use a specific image (with an arrow). class UserLocationAnnotationView: MKAnnotationView { override init(frame: CGRect) { super.init(frame: frame) } override init(annotation: MKAnnotation!, reuseIdentifier: String!) { super.init(annotation:

MKMapView ignores update of centerOffset in iOS 4

旧街凉风 提交于 2019-11-30 17:55:53
I previously created a custom callout bubble as a subview to the MKAnnotationView because the built in callout is so limited. This requires me to change to centerOffset of the MKAnnotationView when it is selected to account for the size of the callout bubble. This all worked perfectly before iOS 4 came out. Now, with iOS 4, it completely ignores my updating of the centerOffset property and therefore the pin and bubble appear to jump down and to the right (the top left corner of the callout bubble is now at the location where the pin point should be). Does anyone know why this has changed in

MKMapview annotation dynamic pin image changes after zooming

安稳与你 提交于 2019-11-30 17:10:37
问题 I am working on a little project that shows 7 different types of annotations on the map. My annotations are taken from a url result in array and I parse it using JSON. I have lots of annotations and everything seems to look good once the map loads. After zooming in and zooming out, the the pin images changes for some reason to the wrong pin image (a specific image, no clue why). I am sure I am missing something here...may you please help :) ? Here's one part of my code, let me know if you

MKMapView ignores update of centerOffset in iOS 4

时间秒杀一切 提交于 2019-11-30 16:45:54
问题 I previously created a custom callout bubble as a subview to the MKAnnotationView because the built in callout is so limited. This requires me to change to centerOffset of the MKAnnotationView when it is selected to account for the size of the callout bubble. This all worked perfectly before iOS 4 came out. Now, with iOS 4, it completely ignores my updating of the centerOffset property and therefore the pin and bubble appear to jump down and to the right (the top left corner of the callout

iOS 8 MKAnnotationView rightCalloutAccessoryView misaligned

末鹿安然 提交于 2019-11-30 10:44:15
问题 I'm still pretty new to the iOS stuff in general and found a problem while testing our App for iOS 8 compatibility. In iOS 7 everything worked fine but on iOS 8 the rightCalloutAccessoryView is misaligned under certain circumstances. First Screenshot: Correctly aligned Second Screenshot: Wrong alignment As you can see, the problem takes place when the InfoWindow has a long title. But this was not the case on iOS 7 and I couldn't find anything mentioning this has changed? I tried to understand

How to resize MKAnnotationView on iOS6?

你说的曾经没有我的故事 提交于 2019-11-30 10:28:03
Resize MKAnnotationView Image When map zooms in and out? This methord are successful on iOS5, but failed on iOS6. I change the MKAnnotationView's transform directly, and no luck. The MKAnnotationView only resize in a flash(When touch up inside the MKMapView, after the touch up finish, the MKAnnotationView will restore the original size). My code are below: - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated { for (id <MKAnnotation>annotation in _mapView.annotations) { // if it's the user location, just return nil. if ([annotation isKindOfClass:[MKUserLocation class]])

iOS 8 MKAnnotationView rightCalloutAccessoryView misaligned

僤鯓⒐⒋嵵緔 提交于 2019-11-29 22:11:18
I'm still pretty new to the iOS stuff in general and found a problem while testing our App for iOS 8 compatibility. In iOS 7 everything worked fine but on iOS 8 the rightCalloutAccessoryView is misaligned under certain circumstances. First Screenshot: Correctly aligned Second Screenshot: Wrong alignment As you can see, the problem takes place when the InfoWindow has a long title. But this was not the case on iOS 7 and I couldn't find anything mentioning this has changed? I tried to understand why and find a way to resolve this, but couldn't find anything yet. Is this solvable on our own or do

iOS refresh annotations on mapview

心不动则不痛 提交于 2019-11-29 19:17:07
问题 I have a mapview where the annotation's coordinates are constantly being updated but when I use setCoordinate, the annotation does not move. How do I refresh the annotations to reflect their coordinates? - (void)updateUnits { PFQuery *query = [PFQuery queryWithClassName:@"devices"]; [query whereKeyExists:@"location"]; [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { if (!error) { for (PFObject *row in objects) { PFGeoPoint *geoPoint = [row objectForKey:@"location"