mapkit

Query a GeoPoint from Parse and add it to MapKit as MKAnnotation?

末鹿安然 提交于 2019-11-30 16:23:00
I am trying to query an array of PFGeoPoints stored on the Parse backend. I have a PFObject in Parse called "Post", with data assigned to it such as "location", "title", "message", etc. everything is being sent to Parse upon posting from my app and is properly stored in the backend. I am having issues retrieving properties of the "Post" PFObject from Parse and storing them into an MKAnnotation on the map. Here is my MapViewViewController: import UIKit import Parse import CoreLocation import MapKit class MapViewViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate {

How to fill outside overlay circle in iOS 7 on map

你。 提交于 2019-11-30 15:53:29
I need the same filled space around circle on the map as in Reminders app in iOS7. I think need to use the method applyFillPropertiesToContext:atZoomScale or fillPath:inContext: . I solved my problem: - (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context { // Fill full map rect with some color. CGRect rect = [self rectForMapRect:mapRect]; CGContextSaveGState(context); CGContextAddRect(context, rect); CGContextSetFillColorWithColor(context, [UIColor colorWithWhite:0.0 alpha:0.4f].CGColor); CGContextFillRect(context, rect); CGContextRestoreGState

How do I make a pin annotation callout in Swift?

会有一股神秘感。 提交于 2019-11-30 15:37:31
I tried to make the callout work but that didn't happen as I did something wrong in my prepare for segue. I want to know how to be able to make a pin annotation callout to another view? The process of segueing to another scene when the button in the callout is tapped is like so: Set the delegate of the map view to be the view controller. You can do this either in Interface Builder's "Connections Inspector" or programmatically. You want to specify that the view controller conforms to MKMapViewDelegate , too. When you create the annotation, make sure to set the title, too: let annotation =

Zoom to fit region for all annotations - ending up zooming in between annotations

拥有回忆 提交于 2019-11-30 15:30:32
I have a problem with fitting all my annotations to the screen... sometimes it shows all annotations, but some other times the app is zooming in between the two annotations so that none of them are visible... I want the app to always fit the region to the annotations and not to zoom in between them... what do I do wrong? if ([mapView.annotations count] == 2) { CLLocationCoordinate2D SouthWest = location; CLLocationCoordinate2D NorthEast = savedPosition; NorthEast.latitude = MAX(NorthEast.latitude, savedPosition.latitude); NorthEast.longitude = MAX(NorthEast.longitude, savedPosition.longitude);

MKPointAnnotations touch event in swift

寵の児 提交于 2019-11-30 15:21:05
问题 I would like to know if anyone can tell me how I can touch a pin on the map in the form of MKPointAnnotations . I would like to click the pin on the map and go to another view by bringing back the variables of the pin that I have preset . Can anyone explain me this thing in Swift ? thanks Edit with code: class ViewController: UIViewController, MKMapViewDelegate { @IBOutlet weak var mappa: MKMapView! override func viewDidLoad() { super.viewDidLoad() var location : CLLocationCoordinate2D =

Displaying Pin with Title (annotation) once map loads

亡梦爱人 提交于 2019-11-30 15:17:00
问题 I am working on my first app and within it I'm just trying to have on button click show a map with a pin (and title on this pin of location). I was able to load the mapview and to have it show the coordinates I want. But when trying to display the pin and annotation I am having issues. Not sure where to code this and how to make annotation to display pin. I've searched and seen many tutorials, but most show a different mapview style and are showing pin on user selection, I want to show pin on

Zoom in on User Location- Swift

守給你的承諾、 提交于 2019-11-30 15:13:07
I can't figure out how to get the map to zoom in on the user location from viewDidLoad. I tried setting a region, and that didn't work. This is the code I have, any tips? @IBOutlet weak var mapView: MKMapView! var MapViewLocationManager:CLLocationManager! = CLLocationManager() var currentLocation: PFGeoPoint! = PFGeoPoint() override func viewDidLoad() { super.viewDidLoad() self.mapView.showsUserLocation = true mapView.delegate = self MapViewLocationManager.delegate = self mapView.setUserTrackingMode(MKUserTrackingMode.Follow, animated: true) } I have looked up the answers for this question but

Map button refresh location

自闭症网瘾萝莉.ら 提交于 2019-11-30 14:59:36
I am working on my first swift application for the iPad. Thus far I have a basic mapview with a button in the bottom toolbar, which I would like to refresh and focus onto the users location once clicked. Currently I have this code: import UIKit import MapKit import CoreLocation class ViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate { var location: CLLocation! let locationManager = CLLocationManager() @IBOutlet weak var mapView: MKMapView! @IBOutlet weak var refresh: UIBarButtonItem! @IBAction func refresh(sender: AnyObject) { let center = CLLocationCoordinate2D

MapTypeStyle in MapKit

ⅰ亾dé卋堺 提交于 2019-11-30 14:56:34
I wonder to know if there is any way to configure our MapKit maps like we do with the MapTypeStyle object in the Google Maps API. If I refer to Apple doc's, MKMapView has a mapType option that takes MKMapType constant but no styles parameters like MapOptions with the MapTypeStyle and the MapTypeStyler wich is very powerfull for fast maps customizing. So my question is : Is there any way to achieve something similar with the MapKit framework, if not, what is the best framework/library to do this ? I'm thinking of MapBox and similar products. There are a few options for you my friend. You could

MKPolyline / MKPolylineRenderer changing color without remove it

怎甘沉沦 提交于 2019-11-30 14:16:07
I working around with map app, I want to ask how to change the polyline color without remove and add it again, I found this topic https://stackoverflow.com/questions/24226290/mkpolylinerenderer-change-color-without-removing-overlay in stackoverflow but this is not involve with my question, I did not touch the line, so no need to do with -[MKMapViewDelegate mapView:didSelectAnnotationView:] So is it possible to do that? EDIT: What I want to do is change the polyline color smoothly (by shading a color - sound like an animation) If you have any idea on how to animate this polyline please also