mkannotationview

how to add custom callout view in mapview

天大地大妈咪最大 提交于 2019-12-05 02:20:34
I am new to mapkit in objective-c. I am able to add custom annotation in mapview. i need to place custom callout view like below image . But i didn't get how can i design callout view like this. i know i need to add callout in view for annotation method. - (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation { static NSString *AnnotationViewID = @"annotationViewID"; MKAnnotationView *annotationView = (MKAnnotationView *)[mapview dequeueReusableAnnotationViewWithIdentifier:AnnotationViewID]; if (annotationView == nil) { annotationView = [[

I have 30 annotations, and growing. Looking for a simpler way to code this?

北城余情 提交于 2019-12-05 02:20:26
问题 I am coding multiple annotations into a project. Currently I have 30 annotations, and growing. I'm wondering if there is a simplier way of having to create a annotation.h and annotation.m classes for each single annotation. Currently in my map view controller, I create the annotation objects and place them in an array, which has been working well for me but as you could imagine, its a lot of code to manage once you have tons of annotations, not to mention tons of classes. So for example, one

MKMapView -> display a button for my location

徘徊边缘 提交于 2019-12-04 23:37:25
问题 I have a MKMapView implemented with these lines of source code (my location is a blue bullet, the other one's are purple pins): - (MKAnnotationView *)mapView:(MKMapView *)mapViewLocal viewForAnnotation:(id <MKAnnotation>)annotation { if (annotation == mapViewLocal.userLocation) { mapViewLocal.userLocation.title = @"Test"; [mapViewLocal setRegion:MKCoordinateRegionMakeWithDistance(mapViewLocal.userLocation.coordinate, 1000, 1000) animated:YES]; return nil; } MKPinAnnotationView *pinView =

MapKit update annotation image

女生的网名这么多〃 提交于 2019-12-04 17:17:06
I'm having a problem finding out the way to update a custom MKAnnotationView image after a asynchronous request completes with information about the status of the annotation. So far, I have this: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { static NSString *identifier = @"EstacionEB"; if ([annotation isKindOfClass:[EstacionEB class]]) { EstacionEB *location = (EstacionEB *) annotation; CustomPin *annotationView = (CustomPin *) [_mapita dequeueReusableAnnotationViewWithIdentifier:identifier]; if (annotationView == nil) { annotationView = [

iOS MapKit Annotation, not showing correct location

拜拜、爱过 提交于 2019-12-04 14:05:21
I using a custom image for my mapkit annotation. But the main problem it seems that I am running into in using a custom image, is that when zoomed out, the annotation is not in the correct point on the map, and ONLY until I zoom in all the way down, will it show the annotation point in the correct place. It seems that when I use a regular pin MKPinAnnotationView , it works normally, as with the pin being in the correct place zoomed in or out, thanks in advance for anyone that can help. The code I have used is as follows: - (MKAnnotationView *)mapView:(MKMapView *)aMapView viewForAnnotation:(id

Swift - setting rounded corners to annotation view image

房东的猫 提交于 2019-12-04 13:39:37
Here is my previous thread, where I set image to annotation view pins Swift - setting different images from array to annotation pins Right now I encountered a problem with setting rounded corners on annotation view image. cannot show callout with clipsToBounds enabled swift appears that I have to choose between rounded corners or showing callout, I don't really get why these two can't come along. Is there any way to do that? Here is my viewForAnnotation function: func mapView(mapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView! { if !(annotation is

How to change default background color of callout bubble with detailCalloutAccessoryView

夙愿已清 提交于 2019-12-04 10:28:31
In my app I have the following sutuation. I've implemented a custom callout bubble with custom detailCalloutAccessoryView with two labels inside. I know how to change the color of detailCalloutAccessoryView with this line. view.detailCalloutAccessoryView?.backgroundColor = UIColor.red But I can't figure out how to change background color of the main bubble (it is transparent grey/white now). With view.detailCalloutAccessoryView?.backgroundColor = UIColor.red line my calloutbubble looks like this: But I want my custom bubble to look like this: Here is my viewFor annotation method: func mapView(

Subclasses of MKAnnotationView

99封情书 提交于 2019-12-04 06:59:17
I was wondering if anyone knows of any subclasses for the MKAnnotationView class. On apples documentation they say one example is the MKPinAnnotationView so I was wondering if there were other pre-created subclasses like the one used to track the devices current location. If anyone has tips for creating my own subclass of the MKAnnotationView class that be great as well. Thanks, bubster I don't know of any other templates, but that does not mean that they don't exist. :) Anyway, here's how to create custom ones: Create a new class conforming to the MKAnnotation protocol. You will need to have

MKMapView MKAnnotationView ISSUE?

こ雲淡風輕ζ 提交于 2019-12-04 06:29:47
问题 I have a map view with pins that when the user selects a pin it goes to a detail screen for that pin. I also have a table view that when the user selects an item it goes to the same type detail view. I am adding the multiple pins in mapview through array. I have added button to the accessory view, Here's the problem ... when I tap the button pin selection takes him to the detail view for a different pin. But in the table view it still works fine..anyone pls help me with this...? -

Custom font for MKAnnotationView Callout

心已入冬 提交于 2019-12-04 04:55:00
问题 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? 回答1: Since I needed the Swift version - here it is. Also, you have to call setNeedsLayout() on