mapkit

Convert MKAnnotation Coordinates to View Coordinates

梦想的初衷 提交于 2019-12-01 22:01:46
I am displaying a custom UIView when the user clicks on the pin (Like the Zillow app). Now the problem is that I need to place the view right above the actual pin. The MKAnnotationView coordinates system is related to the map. How can I get the coordinates with respect to the iPhone screen and then place my view on that coordinate. - (void)mapView:(MKMapView *)mv didSelectAnnotationView:(MKAnnotationView *)view { // get view from storyboard ZillowSearchResultAnnotation *annotation = (ZillowSearchResultAnnotation *) view.annotation; PropertyAbstractViewController *propertyAbstractViewController

Why is the MKMapView's userLocation property rubbish … for a while?

孤者浪人 提交于 2019-12-01 21:52:01
I have a Map View defined in IB and it is set to show the user location. In my app, in -viewDidAppear , I query self.mapView.userLocation.location.coordinate and it comes back with insane values such as: latitude : 4.8194501961644877e-49 longitude : 2.2993313035571993e-59 However, the next time -viewDidAppear is called (after I've simply moved to another tabbed view and then back to this one) the userLocation property holds exactly the correct values for my current location. It seems that at the time of my initial call, the userLocation property has not been initialised but despite having read

Tilt map in Mapkit programmatically using Swift

空扰寡人 提交于 2019-12-01 20:16:36
I'd like to tilt the map at startup. (Same as the user does when scrolling up or down with 2 fingers) Is this possible using Swift? MKMapView Class Reference : http://goo.gl/djHXPn Look at the camera property : A camera object defines a point above the map’s surface from which to view the map. Applying a camera to a map has the effect of giving the map a 3D-like appearance. You can use a camera to rotate the map so that it is oriented to match the user’s heading or to apply a pitch angle to tilt the plane of the map. Assigning a new camera to this property updates the map immediately and

Let users choose between Google Maps and Apple Maps in IOS 6?

南楼画角 提交于 2019-12-01 20:08:37
问题 I am using basic MapKit functionality in my iOS app. Is there a way to let my iOS 6 users choose between Google and Apple maps for the mapping data presented within my app? If so, how can I do this programmatically? 回答1: No. You can let users choose between iOS maps and other maps (OpenStreetMap, Microsoft VirtualEarth, CloudMade, OpenAerialMap, OpenCycleMap, SpatialCloud, TileStream7) with route me (on github) or you can go with Bing maps (also a library available). But you'll have to code

Moving annotations in MKMapView according to server data (latitude and longitude)

这一生的挚爱 提交于 2019-12-01 19:08:48
In my app I am showing location of some other person by getting their location (latitude and longitude) from server at particular interval. After getting I have to remove all annotations and drop new annotations based on the server data. But it looks very inefficient as when we have the annotation for the same user previously exists even then I'm removing and adding the same user annotation. So I want to know can we move the MKAnnotation from one coordinate to other? I have tried "setCoordinate" property but unable to succesfuly implement it. Also it is not "touch and drag" kind. The

Let users choose between Google Maps and Apple Maps in IOS 6?

跟風遠走 提交于 2019-12-01 18:39:05
I am using basic MapKit functionality in my iOS app. Is there a way to let my iOS 6 users choose between Google and Apple maps for the mapping data presented within my app? If so, how can I do this programmatically? No. You can let users choose between iOS maps and other maps (OpenStreetMap, Microsoft VirtualEarth, CloudMade, OpenAerialMap, OpenCycleMap, SpatialCloud, TileStream7) with route me (on github) or you can go with Bing maps (also a library available). But you'll have to code for the different libraries as the MapKit Framework is only available for Apple maps in iOS 6. ClassicMap

MKMapView memory usage steadily increasing

萝らか妹 提交于 2019-12-01 18:03:45
In my app, I've noticed that as I push and pop a view controller containing an MKMapView , memory usage steadily increases. I've determined that there is a problem with MapKit itself, not my code, though. I made a test project containing simply a navigation controller in which I repeatedly can push and pop a view controller containing nothing but a map view- no annotations or overlays. As I push and pop the view controller over and over, memory usage increases by about .6 MB each push/pop cycle. Any thoughts as to why this is happening? I am using ARC. Thanks! Edit: I've done some testing in

MKMapView memory usage steadily increasing

蹲街弑〆低调 提交于 2019-12-01 17:52:50
问题 In my app, I've noticed that as I push and pop a view controller containing an MKMapView , memory usage steadily increases. I've determined that there is a problem with MapKit itself, not my code, though. I made a test project containing simply a navigation controller in which I repeatedly can push and pop a view controller containing nothing but a map view- no annotations or overlays. As I push and pop the view controller over and over, memory usage increases by about .6 MB each push/pop

openInMapsWithLaunchOptions not working?

为君一笑 提交于 2019-12-01 15:40:23
问题 I'm passing in options for the map, but this does not seem to do anything with the zoom level?? It keeps the same low zoom level. What have I missed? func openMapForPlace() { let regionDistance:CLLocationDistance = 10000 var coordinates = CLLocationCoordinate2DMake(detailItem!.geoLatitude, detailItem!.geoLongitude) let regionSpan = MKCoordinateRegionMakeWithDistance(coordinates, regionDistance, regionDistance) var options = [ MKLaunchOptionsMapCenterKey: NSValue(MKCoordinate: regionSpan

Problems accessing custom MKAnnotation data via rightCalloutAccessoryView

霸气de小男生 提交于 2019-12-01 14:37:59
I am trying to access some custom data I've setup in my custom annotation data when triggered by the rightCalloutAccessoryView. I am getting a compiler error as described below. Here's my custom MKAnnotation with a couple of extra variables - status & supplierdataindex class CustomMapPinAnnotation : NSObject, MKAnnotation { var coordinate: CLLocationCoordinate2D var title: String var subtitle: String var status: Int var supplierdataindex: Int init(coordinate: CLLocationCoordinate2D, title: String, subtitle: String, status: Int, supplierdataindex: Int) { self.coordinate = coordinate self.title