mapkit

MKPolygon to cover entire earth

若如初见. 提交于 2019-12-25 14:09:49
问题 I'm trying to create an MKPolygon that will cover the entire earth, but can't find the right coordinates. my code looks like this: CLLocationCoordinate2D pathCoords[5]={ CLLocationCoordinate2DMake(0,-90), CLLocationCoordinate2DMake(0,90), CLLocationCoordinate2DMake(-180,90), CLLocationCoordinate2DMake(180,-90), CLLocationCoordinate2DMake(0,-90), }; MKPolygon *result = [MKPolygon polygonWithCoordinates:pathCoords count:5]; I've found this article that can help: http://www-01.ibm.com/support

MKPolygon to cover entire earth

旧街凉风 提交于 2019-12-25 14:09:18
问题 I'm trying to create an MKPolygon that will cover the entire earth, but can't find the right coordinates. my code looks like this: CLLocationCoordinate2D pathCoords[5]={ CLLocationCoordinate2DMake(0,-90), CLLocationCoordinate2DMake(0,90), CLLocationCoordinate2DMake(-180,90), CLLocationCoordinate2DMake(180,-90), CLLocationCoordinate2DMake(0,-90), }; MKPolygon *result = [MKPolygon polygonWithCoordinates:pathCoords count:5]; I've found this article that can help: http://www-01.ibm.com/support

How to Pass Variables from a Subclass via a Segue to a SecondViewController

喜夏-厌秋 提交于 2019-12-25 11:58:20
问题 I have a subclass called "Capital" that declares variables and I would like to push these variables via the subclass to a new SecondViewController via a segue In addition to the subclass "Capital" I also have (2) ViewControllers: ViewController -> SecondViewController Here is my code for the subclass called "Capital" import MapKit import UIKit class Capital: NSObject, MKAnnotation { var title: String? var coordinate: CLLocationCoordinate2D var info: String var imageForAnnotationView: UIImage?

Add annotation after retrieving users latitude and longitude from Firebase

心已入冬 提交于 2019-12-25 09:22:32
问题 I am trying to add a mapView annotation of all the online user after retrieving their latitude and longitude from Firebase. I am able to print it as an optional or as a CLLocationDegrees aka Double, but when I try to add it into my user.userAnnotation attribute I get a fatal error. This is what I am printing: this is the users lat Optional(19.435477800000001) this is the user latitude in CLLocationDegrees 19.4354778 fatal error: unexpectedly found nil while unwrapping an Optional value And

Blur on MKMapView

你说的曾经没有我的故事 提交于 2019-12-25 09:05:25
问题 I know this question has been asked before, but I am trying to put a blur on a map view in my app. Everything I've tried just tints the map including code like this: var darkBlur = UIBlurEffect(style: UIBlurEffectStyle.Dark) var blurView = UIVisualEffectView(effect: darkBlur) blurView.frame = mapView.bounds mapView.addSubview(blurView) Is there a way to actually blur the map? 回答1: Did you try adding blurView to mapView 's superview? Works fine for me in Playground: 来源: https://stackoverflow

How to extend MKPointAnnotation and add a property to it

冷暖自知 提交于 2019-12-25 06:05:15
问题 I'm trying to extend MKPointAnnotation and add a property to for an NSString called dealLink. I thought I set it up correctly, but I'm getting this error at the moment: Property 'dealLink' not found on object of type 'MKPointAnnotation *' Here's my code in a view controller called MapOffersViewController.m: #pragma mark - Populate Map - (void)populateMap:(MKMapView*)map withDeals:(NSArray*) deals { NSLog(@"Deals " ); for (NSDictionary *currentDeal in deals) { CLLocationCoordinate2D ctrpoint;

Add audio to Map on iOS

假装没事ソ 提交于 2019-12-25 04:26:34
问题 I have a map right now with several points on it that are quite close to each other. Right now when a user taps the annotation a little pop up occurs with the location name on it. How could I have it so that a piece of audio about that location plays? I'm not too fussed about pause buttons etc yet, right now I want to know how I'd implement audio into this! 回答1: Use AVSpeechSynthesizer AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc]init]; AVSpeechUtterance *utterance =

How to resize the custom annotation pin image in MKMapView?

风流意气都作罢 提交于 2019-12-25 03:51:50
问题 I am using swift 4. I have added MKMapView with some pins but I need to resize the pin image based on the map zooming. So if anyone knows, how to resize the image based on map zooming? 回答1: You can't. Pins always say a constant size as the user zooms the map. You'll want to look into using a MKOverlay and possibly a custom MKOverlayRenderer subclass. That will allow you to draw content that grows and shrinks as the user zooms in and out. 来源: https://stackoverflow.com/questions/52782144/how-to

How to resize the custom annotation pin image in MKMapView?

北慕城南 提交于 2019-12-25 03:51:27
问题 I am using swift 4. I have added MKMapView with some pins but I need to resize the pin image based on the map zooming. So if anyone knows, how to resize the image based on map zooming? 回答1: You can't. Pins always say a constant size as the user zooms the map. You'll want to look into using a MKOverlay and possibly a custom MKOverlayRenderer subclass. That will allow you to draw content that grows and shrinks as the user zooms in and out. 来源: https://stackoverflow.com/questions/52782144/how-to

MKPinAnnotationView - different actions in different Pins

筅森魡賤 提交于 2019-12-25 03:36:19
问题 I have a question about the MKPinAnnotationView. First of all I entered coordinates of the pins and after that called the viewForAnnotation to build them and also add them the a right button. But my question is how can I select different actions for those pins? When I look for the button tag in NSLog, it always shows 0 for every pin so I can't make it with tags. Here is the code of the button if it means something: for (int i=0;i<=[[mapview annotations]count];i++) { pinView.tag = i ;