mkmapview

swift remove map overlays

别说谁变了你拦得住时间么 提交于 2019-12-10 17:22:57
问题 I am trying to remove overlays from map. func removeMapOverlay() { var removeOverlays : [AnyObject]! = self.mapView.overlays // Above line throws runtime exception self.mapView.removeOverlays(removeOverlays) } self.mapView.overlays are type of AnyObject array. var overlays: [AnyObject]! { get } . So initially I wrote var removeOverlays = self.mapView.overlays It throws EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) exception at this line on runtime. So I did type casting for

Change map type of an MKMapView

[亡魂溺海] 提交于 2019-12-10 17:17:38
问题 I'm trying to develop an interface for the user to change mapType views. I'd like to implement this by adding a fold effect to the bottom-right corner of the mapview where the user can press or press and drag in the bottom-right corner and the map will fold up just enough to reveal the 3 different mapTypes: regular, hybrid, and satellite. This is the same functionality that google maps on the iPhone has. Load the app and notice the 'paper-folding' button in the lower right corner. Press it

Custom map callout view hides on tap

早过忘川 提交于 2019-12-10 15:46:47
问题 I've made custom map callouts. My callouts contains UIButtons and UITextView . When I tap UIButton , it presses nice. But when I tap UITextView it moves cursor to tap position and then deselects pin and disappears callout... I've implemented hitTest:withEvent: method of MyAnnotationView like here: https://stackoverflow.com/a/13495795/440168 But as I see in log, [super hitTest:withEvent:] never returns nil . Here is my MyAnnotationView methods: - (BOOL)pointInside:(CGPoint)point withEvent:

Searching Annotations in MapView

家住魔仙堡 提交于 2019-12-10 15:26:02
问题 I followed a how-to-search-for-location-using-apples-mapkit about searching annotations in mapView and its searching around the world with MKLocalSearch . However, I don't want to to search with MKLocalSearch but search my own annotations i added myself like these for example: let LitzmanLocation = CLLocationCoordinate2DMake(32.100668,34.775192) // Drop a pin let Litzman = MKPointAnnotation() Litzman.coordinate = LitzmanLocation Litzman.title = "Litzman Bar" Litzman.subtitle = "נמל תל אביב 18

MKPolyline -> NSKeyedArchiver -> NSData SIGABRT

梦想的初衷 提交于 2019-12-10 15:19:29
问题 In my app I am trying to store an array of MKPolylines into NSUserDefaults . NSData *data = [NSKeyedArchiver archivedDataWithRootObject:overlays]; [[NSUserDefaults standardUserDefaults] setObject:data forKey:@"theKey"]; Gives: [MKPolyline encodeWithCoder:]: unrecognized selector sent to instance 0x169c20` Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [MKPolyline encodeWithCoder:]: unrecognized selector sent to instance 0x1c57e0' Edit: I made some progress.

MKMapKit exception when using canShowCallout on annotation view

霸气de小男生 提交于 2019-12-10 14:46:44
问题 I'm trying to use a pretty straightforward custom map annotation view and callout - the annotation view when I create it, just adds a UIImageView as a subview to itself. That works fine. However, when I call canShowCallout on the annotation view, An exception is thrown in MapKit immediately after returning the view. The end of the stack looks like: #0 0x94e964e6 in objc_exception_throw #1 0x01e26404 in -[MKOverlayView _addViewForAnnotation:] #2 0x01e22037 in -[MKOverlayView

All Annotation is not visible to user in MKMapView

我怕爱的太早我们不能终老 提交于 2019-12-10 14:13:01
问题 I am using MKMapView and have added a number of annotation pins to the map. All annotation belong to different country, so i do not able to set all annotation visible to user. Please do try using below latitude and longitude for annotation. First annotation Latitude: 23.029690 First annotation Longitude: 72.527359 Second annotation Latitude: 34.210855 Second annotation Longitude: -118.622636 Code for add annotation to mapview. CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake([

Choosing native Apple or Google Maps SDK for iOS app [closed]

徘徊边缘 提交于 2019-12-10 13:08:21
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . This is a less programmatic and more service related question. I used apple native maps API which integrated google maps service before iOS6 independent apple maps release. So now I am confused between selecting Apple & Google Map. After last year maps problem Apple seem to

Flickering MapOverlay after zoom out and zoom in-iOS

删除回忆录丶 提交于 2019-12-10 12:59:25
问题 I have two questions. First of all, once I allocate memory for the coordinates please see the code below, do I have to free memory free(coords)? Second, as you seen below code, I get overlay and add on the map. However, there is a different timestamps feeds coordinates and should update map. Like a radar map changing overlay shape with different time stamps.It is updating very well initially; however, once user zoom out and zoom in, it starts flashing or flickering. I wonder why this

Show custom contact information

允我心安 提交于 2019-12-10 11:42:19
问题 So I have an MKMapView and I have a pin on it with a disclosure button. I want the user to be able to tap the disclosure button and the navigation controller to push a new view controller. But I want that new view controller to look like the contacts viewController that comes standard in the contacts app. I need it to display custom contact information because the contact will not be in the users contacts. I have been playing around with ABPerson, but I can't figure it out. I want that