mapkit

iOS : Why can't I get mapkit to display a custom annotation pin image?

时光怂恿深爱的人放手 提交于 2019-12-06 09:27:23
figured that using my own custom pin image for annotations would be super easy. But I have never been able to get it to work, and I have no idea why! I am simply using: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation { if([annotation isKindOfClass:[MKUserLocation class]]) return nil; NSString *annotationIdentifier = @"CustomViewAnnotation"; CustomAnnotationView * customAnnotationView = (CustomAnnotationView *) [self.mapview dequeueReusableAnnotationViewWithIdentifier:annotationIdentifier]; if(!customAnnotationView) { customAnnotationView=[

Why MKTileOverlay repeats same tile over and over for openstreet map in ios, swift4

百般思念 提交于 2019-12-06 09:26:19
问题 I'm using OpenStreet map to with our own map server with iOS. for iOS I couldn't find any third party library (free or paid) which can use with our open StreetMap server. then I decided to go with MKMapView using MKTileOverlay like below : added a MapKit outlet to my storyboard. made a outlet connection and set delegates to self using storyboard and then here is my viewdidload method. let urltemplate = "http://tile.openstreetmap.org/17/94621/62995.png" let overlay = MKTileOverlay(urlTemplate:

Reachability and International Roaming

房东的猫 提交于 2019-12-06 09:25:50
I am using the Reachability class from Apple to determine whether or not data or wifi is available. However, a user (with a U.S. iPhone) is testing the app in another country and he is seeing the following error while trying to access the MapKit. Console In my research on this error, I have found that PBRequester is ProtocolBuffer . 2012-10-15 21:16:00.921 WrightsCS App[24239:907] PBRequester failed with Error Error Domain=kCFErrorDomainCFNetwork Code=-1018 "International roaming is currently off." UserInfo=0x1e5587d0 {NSErrorFailingURLKey=https://gsp13-cn.ls.apple.com/shift,

iOS: (Swift) How to show distance from current location and exist annotation on annotation subtitle

五迷三道 提交于 2019-12-06 08:44:42
问题 I am currently working on map application base on iOS using Swift language. I would like an suggestion because after I plot all the pins on map view (which I receive data from my server using JSON frameworks call Alamofire) I would like the subtitle of all annotations on map to show distance from user current location. Now it can add annotations onto map view but can only show title and subtitle base on information receive from my server. Thank You. 回答1: If you have two CLLocation instances,

Mapkit pin color not changing

柔情痞子 提交于 2019-12-06 08:02:42
问题 I'm doing the following and always get green pins: pin.pinColor = MKPinAnnotationColorRed; [self.mapView addAnnotation:pin]; [pin release]; pin is of type "NSObject ". All pins come out as green. Should I be doing it differently? 回答1: Make sure your pin class implements the MKAnnotation protocol and I believe to get a non-standard pin color, you'll have to implement the viewForAnnotation method. - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)

How to find Latitude and Longitude from Address in iPhone

北城余情 提交于 2019-12-06 07:56:54
问题 I am making one application in which i am getting the address, i need to find the latitude and longitude from that address and show the place in map - (void)viewDidLoad { [super viewDidLoad]; [mapView setMapType:MKMapTypeStandard]; [mapView setZoomEnabled:YES]; [mapView setScrollEnabled:YES]; mapView.showsUserLocation = YES; MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } }; geoCoder.delegate = self; [geoCoder start]; double latitude = 0, longitude = 0; region.center.latitude =

Routing Data for MKMapKit in iOS6

核能气质少年 提交于 2019-12-06 07:43:26
问题 I have done routing in iOS apps before, but with iOS6 we are now displaying Apple maps - which causes a problem because we are using Google routing data and if we use Google data, we are supposed to be displaying it on a Google map. I have been searching but as far as I can tell, Apple does not provide any routing data. The closest thing to an answer so far seems to be when Apple says Apps that consume direction information do so by sending an appropriate request to the Maps app, which then

How to display title for multiple annotations directly when map loaded

对着背影说爱祢 提交于 2019-12-06 07:26:44
I am loading Multiple annotations onto my map view. These annotations displays as a pin when the map is loaded. By using the below code i can display title directly for one annotation, but for remaining annotations user is required to tap on the pin for title to see. I want to display the title for all the annotations when the Mapview Loaded without touching the annotation pin NSMutableArray * locations = [[NSMutableArray alloc] init]; _myAnn = [[MKPointAnnotation alloc] init]; _locationCoordinate.latitude = 27.175015; _locationCoordinate.longitude = 78.042155; _myAnn.coordinate =

Custom MKMapView callout not responding to touch events

谁说我不能喝 提交于 2019-12-06 07:02:43
I have a custom UIView that I am displaying as a callout when the user clicks on a custom annotation on an MKMapView . To achieve this I have subclassed MKAnnotationView and overloaded the -setSelected:selected animated: method as suggested in this answer . Basically, I am adding my custom view as a subview of my MKAnnotationView subclass. The problem is that I can't interact with the callout, which contains a button and a scrollable webview, at all. What's more, if the callout hides an annotation and I press the callout at the approximate location of that hidden annotation, the callout will

Swift - setting rounded corners to annotation view image

不想你离开。 提交于 2019-12-06 07:01:38
问题 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: