mkmapview

How to draw a route between my current location to desired location on MKMapView?

久未见 提交于 2019-12-24 00:59:21
问题 I want to show a route between my current location and desired location. I am able to do this but when the source point and destination point so far then it will not show a route and gave the memory warning. Can you suggest any sample code or any way to do this? 回答1: Following Code for the draw path between the current location to desire location - (void)viewDidLoad { [super viewDidLoad]; mapView = [[[MapView alloc] initWithFrame: CGRectMake(0, 0, self.view.frame.size.width, self.view.frame

Bug with MKMapView's centerCoordinate during rotation?

泪湿孤枕 提交于 2019-12-24 00:16:32
问题 I think I may have found a bug in MKMapView , but I'd like to run it by folks to see if anyone else has run into this issue. I'm using iOS 7 and Xcode 5. In my storyboard, I have a view controller with an MKMapView in it. My app allows rotation to both portrait and landscape. I am using autolayout to keep the frame of the MKMapView updated when the user rotates the device. After rotation, it appears that MKMapView is reporting an incorrect centerCoordinate in the regionDidChangeAnimated

MKAnnotation not responding on tap

痞子三分冷 提交于 2019-12-23 23:13:39
问题 I am displaying several pins on map just like this: for (int i = 0; i < points.count; i++) { if([[[points objectAtIndex:i] objectForKey:@"lat"] class] != [NSNull class]) { southWest.latitude = MAX(southWest.latitude , [[[points objectAtIndex:i] objectForKey:@"lat"] doubleValue]); southWest.longitude = MIN(southWest.longitude, [[[points objectAtIndex:i] objectForKey:@"lon"] doubleValue]); northEast.latitude = MIN(northEast.latitude, [[[points objectAtIndex:i] objectForKey:@"lat"] doubleValue])

Sharing a mkmapview screenshot

大憨熊 提交于 2019-12-23 20:02:02
问题 I have a map with lots of stuff on it, which I'd like to share in form of a picture/screenshot. However, as far as i know, the map --both iOS 6 for Apple and iOS 5 for Google-- is copyrighted and I can't simply do that. I thought of Google Static Maps API, but I didn't find something similar for the Apple maps to be available. How could I share a mapview picture without violating their rules and still using the MapKit framework ? Thanks! 回答1: I'm struggling myself with laws of sharing Apple

How to save the selected MKAnnotation?

久未见 提交于 2019-12-23 19:35:53
问题 I have an app that has a mapview, and it shows 20 pins (from an Array) on the map. When the user clicks on it, it can show a bubble with a right accessory button. Here come my problem: How do I know which pin was pressed? I heard something about the mapView:didSelectAnnotationView method, but I don't really understand how do you get the pin/callout index, so that I can get the information of the object at the same index of my Array? Thanks for any help! 回答1: When that method gets called --

How to trace users location on MKMapview and draw line on users path

时光总嘲笑我的痴心妄想 提交于 2019-12-23 19:15:25
问题 I would like to trace my users path on mapView when the user clicks a button on the map and draw a blue or red line along the path like shown in the image below. Also I would like to measure the distance traveled by the user. Currently I am using MKMapView. Is this task possible with iOS map kit or should i move on to using Google maps SDK. I've just started learning iOS development please bear with me if you find the question out of order. Thanks in advance...;) 回答1: Might be a bit too late,

Circle around a point on an MKMapView

假如想象 提交于 2019-12-23 19:06:52
问题 I need to draw a circle with a specified radius around an arbitrary point (not necessarily the user's location) on an MKMapView. I would like the appearance to be similar to the circle that the Maps app uses, to show the accuracy of the user's location. Is there a recommended way of doing this, or will I need to create a custom overlay? 回答1: You might want to look at MKCircle and MKCircleView, which are part of the MapKit API and are designed for drawing circles on an MKMapView. I don't think

iOS7 style mapview callout segue in the callout (calloutAccessoryControlTapped, UIButtonTypeDetailDisclosure)

◇◆丶佛笑我妖孽 提交于 2019-12-23 18:11:05
问题 I have mapview on iPad with annotations and callouts, each callout also has rightCalloutAccessoryView with detail disclosure button. I see the stock Maps app performs segue for callout details within the callout's object. It first performs a transition of the view from right to left like a push segue, then resizes the callout frame based on the detail's content. How should I configure the segue in storyboard to be performed within the original callout and not replace the entire screen? Is it

MKMapView not updating overlay correctly after changing its boundingMapRect

本秂侑毒 提交于 2019-12-23 13:53:14
问题 Below is very simple custom overlay object: @interface Overlay : NSObject <MKOverlay> @property (nonatomic, readonly) CLLocationCoordinate2D coordinate; @property (nonatomic, assign) MKMapRect boundingMapRect; @end @implementation Overlay - (id)init { self = [super init]; if (self) { _coordinate = CLLocationCoordinate2DMake(37.78577, -122.40645); _boundingMapRect.origin = MKMapPointForCoordinate(_coordinate); _boundingMapRect.size = MKMapSizeMake(200, 200); } return self; } @end OverlayView

Should I remove or hide my annotations in MKMapView?

妖精的绣舞 提交于 2019-12-23 09:55:34
问题 I was wondering which would be faster/more efficient when it comes to taking off annotations from the map: hiding or removing. I need to remove and add 100 or so pins every time the user zooms in or out. I can either loop through and hide all annotations using setHidden: , or just remove them using removeAnnotations: . I'm not sure which would be a better method. 回答1: I believe the standard method is to remove them. Less memory overhead. Not that 100 takes up that much, but still better to