mkmapview

NSTimer repeating too fast

不羁的心 提交于 2019-12-08 14:39:42
问题 The Problem I am building an app where I am getting real-time data and updating a MKMapView. I get a batch of data every 10 seconds and between data sets from the webs service I am removing older data points while also adding the new ones. Instead of updating them all at once I want spread out the animation of the new points I get from the data service over that 10 seconds so I create the 'real-time' feel and avoid as many stops and starts as I can. Everything seems to be working great except

Zoom MKMapview to closest two MKAnnotations for current user location

Deadly 提交于 2019-12-08 13:28:56
问题 What is the best way to zoom an MKMapview to closest two or three MKAnnotations for current user location? I have a list of GPS coordinates (328 to be precise) loaded from a plist, every point is an annotation on the map. I'd like to limit the view to the two nearest annotation points around the user's current location. 回答1: Roughly, the steps would be: Find current location, convert to MKMapPoint Iterate your list of annotations, using MKMetersBetweenMapPoints to find distance from current

Use GOOGLE maps in iOS supporting iOS 6 and also iOS 5

痴心易碎 提交于 2019-12-08 12:51:29
I am in a need of having maps support for an app, but the concern is prior to ios 6 the iOS mapKit uses the google maps which is rich in content, but in iOS 6 its using its own maps which is not that rich in content. I have search for the Google API for ios 6, which is great but I need to support prior to ios 6 also. Please help. The new Google Maps SDK for iOS supports back to iOS 5.1, see here: https://developers.google.com/maps/documentation/ios/intro#supported_platforms 来源: https://stackoverflow.com/questions/15127806/use-google-maps-in-ios-supporting-ios-6-and-also-ios-5

Capture MKMapView screenshot different in iOS 5 and iOS 6?

时间秒杀一切 提交于 2019-12-08 12:31:12
问题 I would like to get screenshot of mapview. So i used following code. This code works perfectly in ipad and simulator but not on ipod. The iPad has iOS 6.0 and my xcode is 4.2.1 and the iPod has iOS 5.0. - (UIImage*) renderToImage { UIGraphicsBeginImageContext(mapView.frame.size); [mapView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return viewImage; } The problem is, i have got same image

how to get visible overlays in MapKit? (i.e. MKOverlay/MKOverlayRender from a Mapkit Ivew)

十年热恋 提交于 2019-12-08 12:15:33
问题 How does one get a list (array) of currently visible overlay from a MapkitView? Background - for example I want to show direction arrows to the center of certain Overlay types on my mapkitview, however how do I get the visible ones? There seems to be no way to do this I can see? So do I need to got through all overlays (actually ~8000) and do my own check to see what would be showing on the screen? Seems a waste if MapKit would have already effectively done this as part of deciding what

How to make whole call out tappable?

这一生的挚爱 提交于 2019-12-08 12:04:09
问题 I have added annotation on map and added title, leftCalloutAccessoryView (ImageView), and rightCalloutAccessoryView (UIButton), When tap on button it plays audio, I want instead of tapping on button when i will top on callout any area it starts playing audio. func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? { var annotationView = mapView.dequeueReusableAnnotationViewWithIdentifier("AnnotationImage") if annotationView == nil { if annotation

Mk Mapview keeps resetting on users location?

若如初见. 提交于 2019-12-08 11:58:11
问题 I currently have a map displaying 10 or so co ordinates.The map gets the users location and centers on it as soon as it is opened. When panning the page or zooming different levels it eventually resets and centers in on the first position of the user.I have tried "stopupdating location" and Animated as "NO".I can not get it to stay in positon when the user scrolls the map. - (void)viewDidLoad { [super viewDidLoad]; self.petrolMap.delegate = self; self.location = [[CLLocationManager alloc]

Problems Trying to Find User Location in MKMapView

依然范特西╮ 提交于 2019-12-08 11:56:32
问题 I am having problems trying to get the user's current position to display on an MKMapView. Here is the relevant code: Header: // ParkingMapViewController.m #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface ParkingMapViewController : UIViewController <MKMapViewDelegate, CLLocationManagerDelegate> { MKMapView *mapView; CLLocationManager *locationManager; } @property (nonatomic, retain) IBOutlet MKMapView *mapView; @property (nonatomic, retain) CLLocationManager *locationManager; -

Check if MKPolyline intersects MKPolygon

て烟熏妆下的殇ゞ 提交于 2019-12-08 11:24:27
问题 I'm trying to figure out if a MKPolyline intersects an MKPolygon on map. Currently the only idea I have about this is to go through the line and test on every point if it is located in polygon. More exactly, I'm trying to test if there aren't any MKPolygon between MKUserLocation and an objective on map (so MKUserLocation can see that objective). Any more practical idea about how to do this? If not, how to transform the MKPolyLine into a lot of points? 回答1: They both conform to the MKOverlay

Crash when zooming into a MKMapView with a MKPlacemark

感情迁移 提交于 2019-12-08 10:43:10
问题 I'm trying to add a placemark to a map. The placemark is built from an address completely outside of Address Book. My placemark is appearing on the map, but when I try to pinch to zoom in I get a crash: *** -[CALayer objectForKey:]: unrecognized selector sent to instance 0x4569dc0 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[CALayer objectForKey:]: unrecognized selector sent to instance 0x4569dc0' Here's how I'm setting up the address: id