mapkit

Setting the zoom level for a MKMapView

£可爱£侵袭症+ 提交于 2019-11-26 18:49:46
问题 I have a map which shows correctly, the only thing I want to do now is set the zoom level when it loads. Is there a way to do this? Thanks 回答1: I found myself a solution, which is very simple and does the trick. Use MKCoordinateRegionMakeWithDistance in order to set the distance in meters vertically and horizontally to get the desired zoom. And then of course when you update your location you'll get the right coordinates, or you can specify it directly in the CLLocationCoordinate2D at startup

CLLocation Category for Calculating Bearing w/ Haversine function

∥☆過路亽.° 提交于 2019-11-26 18:46:06
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 incorporating the feedback from that other question and I'm still just not getting something. Thanks Here

How to find location using MapKit in Xcode?

左心房为你撑大大i 提交于 2019-11-26 18:30:55
问题 Hey everyone, I was wondering how to use the MapKit in Xcode? A lot of people told me not to use the Google Map website and integrate it with the UIWebView because it seems a little strange when people are viewing the location in a web view, so I was wondering if anyone can help me step-by-step how to setup MapKit, how pinpoint an address location on the map and find the routes between user's current location and the pinpointed address location? Sorry if I'm not a really good programmer with

iPhone current user location coordinates showing as (0,0)

拟墨画扇 提交于 2019-11-26 18:24:36
问题 I'm trying to get the users current latitude and longitude with this viewDidLoad method. The resulting map is correctly indicating the current location however the NSLog consistently shows: 2009-09-19 16:45:29.765 Mapper[671:207] user latitude = 0.000000 2009-09-19 16:45:29.772 Mapper[671:207] user longitude = 0.000000 Anyone know what I am missing here? Thanks in advance for your help! - (void)viewDidLoad { [super viewDidLoad]; [mapView setMapType:MKMapTypeStandard]; [mapView setZoomEnabled

MKMapView setRegion “snaps” to predefined zoom levels?

耗尽温柔 提交于 2019-11-26 18:24:15
问题 Can anyone confirm that setRegion "snaps" to predefined zoom levels and whether or not this behavior is as designed (although undocumented) or a known bug? Specifically, it appears that setRegion snaps to the same zoom levels that correspond to the zoom levels used when the user double-taps the map. I'm trying to restore a previously saved region but this behavior makes it impossible if the saved region was set via a pinch zoom and not a double-tap zoom. A big clue to me that things are

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

倾然丶 夕夏残阳落幕 提交于 2019-11-26 18:13:55
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 annotations are added to the MKMapView instance. Here is -(void)drawRect: for CustomMapAnnotation, which

MKMapView Zoom and Region

。_饼干妹妹 提交于 2019-11-26 18:09:10
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 zoom level. But I really don't have an idea what these values represent(I read the documentation). When I use

Subclassing MKAnnotationView and overriding setDragState

丶灬走出姿态 提交于 2019-11-26 17:44:20
问题 This is about an iPhone App using MKMapKit: I created a custom MKAnnotationView for a draggable Annotation. I want to create a custom animation. I set a custom pin image and the annotation is draggable (which both is not shown here, it happens in the mapview) with the following code: - (void) movePinUpFinished { [super setDragState:MKAnnotationViewDragStateDragging]; [self setDragState:MKAnnotationViewDragStateDragging]; } - (void) setDragState:(MKAnnotationViewDragState) myState { if

Positioning MKMapView to show multiple annotations at once

陌路散爱 提交于 2019-11-26 16:51:11
I've got several annotations I want to add to my MKMapView (it could 0-n items, where n is generally around 5). I can add the annotations fine, but I want to resize the map to fit all annotations onscreen at once, and I'm not sure how to do this. I've been looking at -regionThatFits: but I'm not quite sure what to do with it. I'll post some code to show what I've got so far. I think this should be a generally straightforward task but I'm feeling a bit overwhelmed with MapKit so far. - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:

Tracking MKMapView centerCoordinate while panning

风格不统一 提交于 2019-11-26 16:47:28
问题 I'm implementing a map feature in my app where I allow the user to set their current location by panning around. All this time, I want to have an MKAnnotation in the centerCoordinate . So what I want to do is keep track of when the map's centerCoordinate changes and change the annotation's coordinate correctly. The behaviour would be similar to that of Uber , Hailo and others. I tried a time based implementation where every 0.00001s the centerCoordinate would be checked and the annotation