mapkit

How to detect when MKUserTrackingBarButtonItem is used

為{幸葍}努か 提交于 2019-12-06 03:02:37
问题 I'm currently trying to find a way to detect when the MKUserTrackingBarButtonItem is used, other than deal with the mapView:didUpdateUserLocation: delegate method. I tried to setAction of the MKUserTrackingBarButtonItem to call my function (check this thread), but of curse it removes the updating location action, which I don't want. I don't find any delegate method triggered :/ Thanks for any idea. 回答1: If your MKUserTrackingBarButtonItem has been assigned a MKMapView to operate on then the

Obtaining MKAnnotation's coordinate while dragging

ⅰ亾dé卋堺 提交于 2019-12-06 02:51:46
I'm creating a path (MKPolyline) based on the position of annotations added by the user. I want to allow the users to change the path by dragging the pins. I currently can do that, but the MKPolyline doesn't update until the pin is dropped. I implemented - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)annotationView didChangeDragState:(MKAnnotationViewDragState)newState fromOldState:(MKAnnotationViewDragState)oldState for the MKAnnotationViewDragStateDragging but it only alerts me that the user is dragging the pin and not notifing about the new position. How can I

Animate a visual element along an arc in MapKit

北城以北 提交于 2019-12-06 02:31:02
问题 How do I add and animate a visual element along an arc, which I have created inside mapkit ? The following code will create a nice arc between two points. Imagine an animated visual that will represent an airplane flying along this arc. -(void)addArc { CLLocationCoordinate2D sanFrancisco = { 37.774929, -122.419416 }; CLLocationCoordinate2D newYork = { 40.714353, -74.005973 }; CLLocationCoordinate2D pointsArc[] = { sanFrancisco, newYork }; // MKGeodesicPolyline *geodesic; geodesic =

How to Open Google Map Navigation Url with Direction and Voice in iOS?

我是研究僧i 提交于 2019-12-06 02:18:16
i am newbie in iOS I want to make an app that contain map kit navigation.i want to open navigation url of google map if user device have Google map application. if it is not contain then i want to open Apple map Here i write a code for like as -(IBAction)navigationButtonPressed:(id)sender { if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"comgooglemaps://"]]) { NSString *urlString=[NSString stringWithFormat:@"comgooglemaps://?center=%f,%f&zoom=14&views=traffic",self.latitude,self.longitude]; [[UIApplication sharedApplication] openURL: [NSURL URLWithString:urlString]];

Check if user location is visible on map iphone

故事扮演 提交于 2019-12-06 01:44:37
问题 I want to hide or show a UIButton weather user's current location is visible on map. While testing the code xcode I can see meassage "User location view is NOT visible but should be. Showing...." on console in "didUpdateLocation" method if users location is not visible on map. How can I use this message to generate events in my case to hide or show a UIButton? Thanks for any help in advance. 回答1: If you want to know whether the user location is contained in the currently displayed map region,

MKTileOverlay with Retina-Tiles

回眸只為那壹抹淺笑 提交于 2019-12-06 01:43:25
问题 I have issues to load 512x512px tiles in MKMapKit. The Server provides 512x512 .jpeg tiles. I could not find any solution or sample implementation for custom retina tiles in MKMapView. What I do: When I load them into MKMapView with overlay = [[MKTileOverlay alloc] initWithURLTemplate:template]; overlay.tileSize = CGSizeMake(512.0f, 512.0f); [_mapView insertOverlay:overlay atIndex:MAP_OVERLAY_INDEX_TILE level:MKOverlayLevelAboveLabels]; … tiles are scaling correct but only half of them is

MKOverlayRenderer to display UIImage over map view

亡梦爱人 提交于 2019-12-06 01:14:12
I'm trying to display an image over a map view in iOS 7. I subclassed MKOverlayRenderer as follows: MapOverlayRenderer.h #import <Foundation/Foundation.h> @import MapKit; @interface MapOverlayRenderer : MKOverlayRenderer @end MapOverlayRenderer.m #import "MapOverlayRenderer.h" @implementation MapOverlayRenderer - (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context { UIImage *image = [UIImage imageNamed:@"marker"]; CGImageRef imageReference = image.CGImage; MKMapRect theMapRect = [self.overlay boundingMapRect]; CGRect theRect = [self

Multiple Annotations ( MKAnnotationView ) in the same location Coordinates

本秂侑毒 提交于 2019-12-06 01:05:12
问题 Hi I am trying to implement Annotations grouping and animation if the user touch. I did look a the different cluster Library solution but this wont work for my because I have multiple Annotations in the same Coordinates. So this is what I want to do 1- I identify where there are multiple Annotations in the same place (Coordinates)? how can implement this ? find the annotations in the same coordinates and make a new group annotation ? 2- change the colour of that Annotation (to let the user

Move MKMapView point to pixel coordinates

柔情痞子 提交于 2019-12-06 01:04:48
I have a quick question. I am using a custom view as a callout accessory for my map view. I am having some issues with getting the annotation to move to the right bottom corner of the said view. I am currently trying to get the CGPoint coords of the selected annotation, but beyond that I've drawn a blank Any help would be greatly appreciated. The current code I'm using (I know it is incorrect is:) CGPoint bottomLeftPoint = CGPointMake(xOffset,[self.internalAnnotationCallout view].frame.size.height); CLLocationCoordinate2D bottomLeftCoord = [self.branchLocation convertPoint:bottomLeftPoint

How do I determine if the current user location is inside of my MKCoordinateRegion?

陌路散爱 提交于 2019-12-05 23:22:26
问题 I have a coordinate region that I have determined contains the limits of what I want to show for my app. I have set this up as an MKCoordinateRegion with center point lat, longitude and a span. How do I determine if the current userLocation is inside of my coordinate region? 回答1: Use map rects. Here's an example using the map's current visible rect. With regards to your question, you could use convertRegion:toRectToView: to first convert your region to a MKMapRect beforehand. MKMapPoint