mkannotationview

MKMapView Off Screen Annotation Image Incorrect

て烟熏妆下的殇ゞ 提交于 2019-12-02 05:37:11
I have a map to which I add several annotations, like so: for (Users *user in mapUsers){ double userlat = [user.llat doubleValue]; double userLong = [user.llong doubleValue]; CLLocationCoordinate2D userCoord = {.latitude = userlat, .longitude = userLong}; MapAnnotationViewController *addAnnotation = [[MapAnnotationViewController alloc] initWithCoordinate:userCoord]; NSString *userName = user.username; NSString *relationship = user.relationship; [addAnnotation setTitle:userName]; [addAnnotation setRelationshipParam:relationship]; [self.mainMapView addAnnotation:addAnnotation]; } Using this

Displaying custom multiple pins shows wrong pins for locations

自作多情 提交于 2019-12-02 05:31:36
This problem has been bugging me for a couple of weeks already! I have a tab bar application. On one tab I am entering points, and on another tab, the points are displayed on a map. Pins should be different dependent on the types of points. The problem that I face is that every time I switch from one tab to another, the pin images change from what they should be to other images. For example, if I have four points on the map, three displayed as a circle and one as a triangle, the triangle will be moving around from one point to another. Images seem to change quite randomly. So, this is the code

MKAnnotationView fault when zoom in/out changed the pin image

女生的网名这么多〃 提交于 2019-12-02 01:40:33
I have used annotation map and used more than one image for the pins but whenever I zoom in or zoom out, it changes all the pins to one image. I get the locations from a web service and to recognise them, I used a string ( CustAttr ) as "T" or "P". The problem is the last call from a web service makes the CustAttr = T and when I zoom in or zoom out, it calls the mapView viewForAnnotation method and draws them all as T and all the P pins are changed. Here is the code for the method : -(MKAnnotationView*) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation { if (

Hiding and disabling user interaction on a MapKit pin?

断了今生、忘了曾经 提交于 2019-12-02 01:16:52
I'm trying to hide a pin on a MapKit view, and while setting the hidden property to YES works, I can still tap on it and get didSelectAnnotationView messages!. Naturally, I tried setting userInteractionEnabled to NO , but I'm still receiving the messages. This is what I've tried. a is my annotation view. a.hidden = YES; a.layer.hidden = YES; a.userInteractionEnabled = NO; There's something that I'm missing here, and I've Googled everywhere and can't find anything that works. Any clues? The enabled property of MKAnnotationView can be set to NO to disable selection as the documentation states:

Custom font for MKAnnotationView Callout

老子叫甜甜 提交于 2019-12-02 01:14:50
Fortunately, the standard callout view for an MKAnnotationView meets our needs - title , subtitle , leftCalloutAccessoryView , and rightCalloutAccessoryView . Unfortunately, we use custom fonts in our app, and would like to extend those custom fonts to these callouts. MKAnnotationView provides no standard way to accomplish this. How can I use a custom font in an MKAnnotation 's callout view? Since I needed the Swift version - here it is. Also, you have to call setNeedsLayout() on didAddSubview() because otherwise when you deselect and reselect the annotation layoutSubviews() is not called and

showing callout after moving mapview

折月煮酒 提交于 2019-12-01 23:13:42
问题 I have several annotations on a mapview. After selecting one of them (callout enabled) I want the map to center on it. I call [mapView setCenterCoordinate:coordinate animated:YES]; in didSelectAnnotationView to achieve that. It works but not always - basically when there is not enough room left to show the callout, the map moves and the annotation is selected, but the callout is not shown (doesn't matter if the move is animated or not). If I don't move the map myself with setCenterCoordinate

Swift - setting different images from array to annotation pins

独自空忆成欢 提交于 2019-12-01 13:15:00
I wonder how to set different images to annotation pins on mapview. The difference between the following questions viewForAnnotation confusion and customizing the pinColor iteratively Swift different images for Annotation is that my array of images is generated dynamically with regard to server response. There is no fixed size of the array, so switch/case construction is not a good idea. Moreover, I'm not sure how to apply the solution with custom class aforementioned in topic above. I'm aware that it would be better to post a comment to one of the questions asked before, but unfortunately I'm

how to change pin color in mapkit under the same annotationview (swift3)

别等时光非礼了梦想. 提交于 2019-12-01 13:04:17
问题 I have 2 pins in mapkit, both are under the same annotation view so it makes since that both of the pins are the same color. How can I make the pins different colors. I would like hello to be red and hellox to be blue. import UIKit import MapKit class ViewController: UIViewController, MKMapViewDelegate { @IBOutlet var jmap: MKMapView! override func viewDidLoad() { jmap.delegate = self; let hello = MKPointAnnotation() hello.coordinate = CLLocationCoordinate2D(latitude: 40, longitude: -73) jmap

Custom Annotation View do not work on iOS6

梦想与她 提交于 2019-12-01 11:47:09
I'm using the J4n0 Callout code ( github ) to implement a custom annotation in MapKit. It was working just fine on iOS5. But on iOS6 I have 2 problems: Annotations are displayed over the AnnotationView (see picture 1). The first Click on an Annotation opens the AnnotationView just fine, but the second click opens an annotation with a bad size (see picture 2). Does anyone using this library have some similar problem/solution? I can give some code if needed! Sibear If annotations are displayed over the AnnotationView try to code: - (void)didMoveToSuperview { [super didMoveToSuperview]; [self

Why is my map view callout translucent/transparent and how do I change it's color?

╄→гoц情女王★ 提交于 2019-12-01 03:18:16
I'm on iOS 7 and I have the following problem. I can't find a clue after some research curiously... I have a map view annotation with left and right accessories but transparent in the middle (default iOS 7 behavior I think). How to change the default translucent/transparent background to any other color I want? Is your MKMapView inside a UITableViewCell ? I had a similar issue, where the UITableViewCellSelectionStyle of the cell caused this visual glitch. Setting it to UITableViewCellSelectionStyleNone fixed it for me. 来源: https://stackoverflow.com/questions/20011902/why-is-my-map-view-callout