mapkitannotation

Custom annotation showing same image for all different types of POI's

放肆的年华 提交于 2019-12-10 00:32:08
问题 I need to show different annotation for different cat_ID on map. in this question i am including only two categories . let item = json["data"].arrayValue var count = 0 initMK() dispatch_async(dispatch_get_main_queue()) { while count < item.count{ let lat = item[count]["comp_lat"].stringValue let lng = item[count]["comp_lng"].stringValue if item[count]["ct_id"].stringValue == "783"{ self.state = "Jachthavens" let poi = MKPointAnnotation() let coordinates = CLLocationCoordinate2D(latitude:

Calculate distance between my location and a MapKit pin on Swift

泪湿孤枕 提交于 2019-12-07 06:04:41
问题 I need your help, I'm working on an App where I have some pins (locations) and what I want is to get the distance between each one and my location. My code is the following let annotation = MKPointAnnotation() let annotationTwo = MKPointAnnotation() let saintPaulHospitalBC = MKPointAnnotation() override func viewDidLoad() { super.viewDidLoad() mapita.showsUserLocation = true // Mapita is the name of the MapView. annotation.coordinate = CLLocationCoordinate2D(latitude: 25.647399800, longitude:

How to display title for multiple annotations directly when map loaded

对着背影说爱祢 提交于 2019-12-06 07:26:44
I am loading Multiple annotations onto my map view. These annotations displays as a pin when the map is loaded. By using the below code i can display title directly for one annotation, but for remaining annotations user is required to tap on the pin for title to see. I want to display the title for all the annotations when the Mapview Loaded without touching the annotation pin NSMutableArray * locations = [[NSMutableArray alloc] init]; _myAnn = [[MKPointAnnotation alloc] init]; _locationCoordinate.latitude = 27.175015; _locationCoordinate.longitude = 78.042155; _myAnn.coordinate =

Custom annotation showing same image for all different types of POI's

久未见 提交于 2019-12-04 20:45:26
I need to show different annotation for different cat_ID on map. in this question i am including only two categories . let item = json["data"].arrayValue var count = 0 initMK() dispatch_async(dispatch_get_main_queue()) { while count < item.count{ let lat = item[count]["comp_lat"].stringValue let lng = item[count]["comp_lng"].stringValue if item[count]["ct_id"].stringValue == "783"{ self.state = "Jachthavens" let poi = MKPointAnnotation() let coordinates = CLLocationCoordinate2D(latitude: Double(lat)!, longitude: Double(lng)!) poi.coordinate = coordinates poi.title = item[count]["comp_name_pub"

Adding a button to MKPointAnnotation?

佐手、 提交于 2019-12-04 06:10:21
问题 I just wrote few lines of code and got stuck trying add a detail button to my annotation point, I don't know how. Does anyone know how to do that? The image below shows what I want to achieve. Thanks! http://i.stack.imgur.com/kK1Ox.jpg Im trying to get the big i in the circle in my annotation. Right now I just have an annotation with a title and a subtitle, which looks like below. http://imgur.com/L3VMe5l.png Also, if you know, when a user clicks on the i in the circle, how do i bring them to

Adding a custom annotation to a MKMapview

℡╲_俬逩灬. 提交于 2019-12-04 05:51:14
问题 I am trying to add annotations to a MKMapView I have created a class CustomMapPin which conforms to the MKAnnotation protocol #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> @interface CustomMapPin : NSObject <MKAnnotation> { CLLocationCoordinate2D coordinate; NSString *title; NSString *subtitle; } @property(nonatomic, assign) CLLocationCoordinate2D coordinate; @property(nonatomic, copy) NSString *title; @property(nonatomic, copy) NSString *subtitle; @property(nonatomic, strong)

Adding a button to MKPointAnnotation?

╄→гoц情女王★ 提交于 2019-12-02 12:31:54
I just wrote few lines of code and got stuck trying add a detail button to my annotation point, I don't know how. Does anyone know how to do that? The image below shows what I want to achieve. Thanks! http://i.stack.imgur.com/kK1Ox.jpg Im trying to get the big i in the circle in my annotation. Right now I just have an annotation with a title and a subtitle, which looks like below. http://imgur.com/L3VMe5l.png Also, if you know, when a user clicks on the i in the circle, how do i bring them to a new segue? Thanks for your help. import UIKit import MapKit class PropertyMasterViewConroller:

Adding a custom annotation to a MKMapview

喜你入骨 提交于 2019-12-02 09:14:55
I am trying to add annotations to a MKMapView I have created a class CustomMapPin which conforms to the MKAnnotation protocol #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> @interface CustomMapPin : NSObject <MKAnnotation> { CLLocationCoordinate2D coordinate; NSString *title; NSString *subtitle; } @property(nonatomic, assign) CLLocationCoordinate2D coordinate; @property(nonatomic, copy) NSString *title; @property(nonatomic, copy) NSString *subtitle; @property(nonatomic, strong) NSString *type; // this is to differentiate between the different annotations on the map @end I have

SWIFT 2: multiline MKPointAnnotation

狂风中的少年 提交于 2019-12-02 03:37:00
问题 Is there a way to create multiline annotations? Here is my code: 1) My customAnnotation class import UIKit import MapKit class CustomAnnotation: NSObject, MKAnnotation { var title: String? var subtitle: String? var address: String = "" var phoneNumber: String = "" var workingHours: String = "" var coordinate: CLLocationCoordinate2D init( title: String, subtitle: String, address: String, phoneNumber: String, workingHours: String, coordinate: CLLocationCoordinate2D ){ self.title = title self

How to Increase the Radius of userLocation Annotation in Mapkit

拟墨画扇 提交于 2019-12-01 10:26:16
问题 My app takes user permission and move the map to the location. And at that position by default MapKit add a blue icon which is generating some pulse. I've searched around but I found how to add a 1000m circle around userLocation . I don't want that. You can say I'm looking to customize the userLocation default annotation . The blue pulse it generates I want to increase that radius . And when this blue pulse hits a custom annotation there should be a method triggered. So how to achieve that?