mapkit

How to keep data associated with MKAnnotation from being lost after a callout pops up and user taps disclosure button?

给你一囗甜甜゛ 提交于 2019-11-26 07:49:27
问题 How do I keep data associated with an MKAnnotation object after the user taps the pin, sees a callout, and taps the disclosure button which opens a detailed view controller? I want to display all data associated with the pin in the detail view controller. I have a simple MKAnnotation class that looks like: #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> @interface VoiceMemoryAnnotation : NSObject <MKAnnotation> { NSString * blobkey; } @property (nonatomic, retain) NSString *

Finding Path/Route Between two points on MapKit in iPhone

空扰寡人 提交于 2019-11-26 07:35:56
问题 I am trying to find the path between two locations on Mapkit. All I have is two locations. Now I have to find the exact path between these points and draw a line between these points using MapKit. I have gone through several examples in which they are using .csv files. In that .csv file they have stored the latitude and longitude values of the full path and drawing line based on those values. But here I am trying to draw a line without knowing the path. So is there any way to find the path

Custom MKAnnotation callout bubble with button

人走茶凉 提交于 2019-11-26 07:23:44
问题 I\'m developing app, where user is localized by gps and then he is asked, whether he is located in specific place. To confirm this, callout bubble is presented to him straight away, asking him, if he is at specific place. As there is alot of similar questions, I was able to do custom callout bubble: My problem: button is not \"clickable\" My guess: because this custom callout is higher than standard callout bubble, I had to place it in negative \"frame\", therefore button cannot be clicked.

iOS 8 Map Kit Obj-C Cannot Get Users Location

点点圈 提交于 2019-11-26 07:19:47
问题 I am working with Map Kit in iOS 8 using Obj-C NOT SWIFT. I cannot get the device location it is set a 0.00, 0.00 and I am getting the error: Trying to start MapKit location updates without prompting for location authorization. Must call -[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager requestAlwaysAuthorization] first. I have implemented: ( I have tried only one at a time and no luck ) if(IS_OS_8_OR_LATER) { [self.locationManager requestWhenInUseAuthorization]; [self

MKPinAnnotationView: Are there more than three colors available?

血红的双手。 提交于 2019-11-26 06:55:54
问题 According to the Apple docs, MKPinAnnotationView\'s pin color is available in red, green and purple. Is there any way to get other colors also? I\'ve found nothing in the docs. 回答1: You might find the following images useful: and the code to use them in viewForAnnotation : - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation { // ... get the annotation delegate and allocate the MKAnnotationView (annView) if ([annotationDelegate.type

CLLocation Category for Calculating Bearing w/ Haversine function

妖精的绣舞 提交于 2019-11-26 06:36:02
问题 I\'m trying to write a category for CLLocation to return the bearing to another CLLocation. I believe I\'m doing something wrong with the formula (calculous is not my strong suit). The returned bearing is always off. I\'ve been looking at this question and tried applying the changes that were accepted as a correct answer and the webpage it references: Calculating bearing between two CLLocationCoordinate2Ds http://www.movable-type.co.uk/scripts/latlong.html Thanks for any pointers. I\'ve tried

How can I create a custom “pin-drop” animation using MKAnnotationView?

孤街浪徒 提交于 2019-11-26 06:15:08
问题 I have an instance of MKMapView and would like to use custom annotation icons instead of the standard pin icons supplied by MKPinAnnotationView. So, I\'ve setup a subclass of MKAnnotationView called CustomMapAnnotation and am overriding -(void)drawRect: to draw a CGImage. This works. The trouble comes when I try to replicate the .animatesDrop functionality supplied by MKPinAnnotationView; I would love for my icons to appear gradually, dropped from above and in left-to-right order, when the

MKMapView Zoom and Region

允我心安 提交于 2019-11-26 06:11:40
问题 I\'m familiar with using Google Maps Javascript API. Recently I started using MapKit framework for an iphone project, but I\'m having a hard time to figure out zooming and setting a region on map. In Google Maps API I used to use integer zoom levels like 8, 9, 10 along with straightforward function setZoom(). The only equivalent method I can see in the MapKit framework is setRegion:animated. As I understand, I need to set a region\'s span\'s latitude and longitude \"delta\" values to specify

Detecting a point in a MKPolygon broke with iOS7 (CGPathContainsPoint)

ε祈祈猫儿з 提交于 2019-11-26 06:01:48
问题 In a SO question I asked earlier this year, I got this chunk of code: MKPolygonView *polygonView = (MKPolygonView *)[self.mapView viewForOverlay:polygon]; MKMapPoint mapPoint = MKMapPointForCoordinate(tapCoord); CGPoint polygonViewPoint = [polygonView pointForMapPoint:mapPoint]; if (CGPathContainsPoint(polygonView.path, NULL, polygonViewPoint, FALSE)) { // do stuff } This works great up until iOS7. It now always returns false and will not detect a point with the path. I\'m trying to find any

How to recognize which pin was tapped

醉酒当歌 提交于 2019-11-26 04:51:55
问题 I got an app with MKMapView and large number of pins on this map. Every pin got rightCalloutAccessoryView . I create it in this way: UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside]; pinView.rightCalloutAccessoryView = rightButton; How should i know, which pin was tapped? Thnx 回答1: In the showDetails: method, you can get the pin tapped from the map view's