mapkit

Why does a custom MKMapView annotation image disappear on touch?

本小妞迷上赌 提交于 2019-12-18 05:03:26
问题 I am annotating my map and setting an image just fine, but when I tap the annotation on the MapView, the image goes from my custom image back to the red pin. Why is this? - (MKAnnotationView *)mapView:(MKMapView *)newMapView viewForAnnotation:(id )newAnnotation { MKPinAnnotationView *annotation = [[MKPinAnnotationView alloc] initWithAnnotation:newAnnotation reuseIdentifier:@"currentloc"]; if (annotation == nil) { annotation = [[MKAnnotationView alloc] initWithAnnotation:newAnnotation

How to handle taps on a custom callout view?

て烟熏妆下的殇ゞ 提交于 2019-12-18 05:01:57
问题 I am adding a callout view like this: func mapView(mapView: MKMapView!, didSelectAnnotationView view: MKAnnotationView!) { let calloutView = UIView(frame: CGRect(x: 0, y: 0, width: 300, height: 120)) calloutView.backgroundColor = UIColor.purpleColor() calloutView.center = CGPointMake(CGRectGetWidth(view.bounds) / 2.0, 0.0) calloutView.layer.anchorPoint = CGPointMake(0.5, 1.0) calloutView.layer.masksToBounds = false calloutView.userInteractionEnabled = true let calloutViewTapRecognizer =

MapKit Annotations Disappearing

半腔热情 提交于 2019-12-18 04:52:35
问题 I have an array of latitudes and another array of longitudes that I add to an array of type CLLocationCoordinate2D. I then use the new array to annotate multiple points on the map. Some, or most, or maybe even all of the annotations are displaying on the map but as I zoom in (yes, zoom IN), some of the annotations disappear, then come back, or dont. Any ideas on how to keep them all visible? This is behavior I would expect while zooming out, not in. Here is the code i'm using for what i've

Custom MKOverlayView line width

与世无争的帅哥 提交于 2019-12-18 04:23:09
问题 I have a custom MKOverlayView, which draws a simple line. In drawMapRect: I am setting CGContextSetLineWidth(context, 30); This looks fine when completely zoomed in, but when you zoom out, the line becomes more and more thin. The MKOverlayView reference says that it automatically scales to the map's zoom level. How can I force it to draw the same width no matter what my zoom level? I notice that MKPolylineView (and MKPolygonView) do this correctly... you can see the line's width resize

how to update MKPolyline / MKPolylineView?

橙三吉。 提交于 2019-12-18 03:57:11
问题 I am trying to create a polyline (MKPolyline) overlay that updates periodically, to simulate the movement of an object. I can achieve this by removing the old overlay, updating the polyline and adding the overlay again, but this leads to flickering. For a point annotation (MKPointAnnotation) you can simply change its coordinate, and the view will be updated automatically and smoothly without having to remove and re-add the annotation. Is this also possible somehow for an overlay? 回答1: yea,

Number of “region” monitored by RegionMonitoring, based on users current location in iOS7

断了今生、忘了曾经 提交于 2019-12-18 03:43:08
问题 I am working on such a project where apps do the following things: User select a radius (10 meter to 1000 meter) and go to next viewController by pressing "Go" button Here apps Grab users current position and start "region monitoring" based on that current position with selected radius If the user cross that certain boundary (10 meter to 1000 meter) then it gives an "ExitRegion" alert message. And start "region monitoring" again based on users new current position. And the apps keep doing

How do I determine if a coordinate is in the currently visible map region?

戏子无情 提交于 2019-12-18 03:01:30
问题 I have a list of several hundred locations and only want to display an MKPinAnnotation for those locations currently on the screen. The screen starts with the user's current location with a 2 mile radius. Of course, the user can scroll, and zoom on the screen. Right now, I wait for a map update event, and then loop through my location list, and check the coordinates like this: -(void)mapViewDidFinishLoadingMap:(MKMapView *)mapView { CGPoint point; CLLocationCoordinate2D coordinate; . . . /*

iPad Mapkit - Change title of “Current Location”

你说的曾经没有我的故事 提交于 2019-12-17 19:46:14
问题 In map view, i'm showing current user location. On click on the pin its showing "Current Location". I want to change it to "My Current Location". How can I change it. Also I want to change the current user location pin color in a timer. Some thing like every one second it should change its color between green, purple and red. Possible to do it? I'm using map kit's show default location and then manipulating the annotation pin color as below: - (MKAnnotationView *)mapView:(MKMapView *)map

MapKit in Swift, Part 2

人走茶凉 提交于 2019-12-17 17:00:17
问题 I'm trying work with Map Kit in Swift. I try to display the area on the map, one pin (MKPinAnnotationView) and the current position. All display fine. I try to add Disclosure Button and intercept tapping on it. Disclosure Button added, but does not work intercept tapping. Function pinPressed with method calloutAccessoryControlTapped not work.... This is a sample code: import UIKit import MapKit import CoreLocation class ViewController: UIViewController, MKMapViewDelegate,

Warning in Custom Map Annotations iPhone

谁说我不能喝 提交于 2019-12-17 16:29:23
问题 I am using a custom map annotation class for map view in iPhone. Whenever I pop my map view from navigation bar stack I usually see some warnings in console. MapAnnotation was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info: I am not using KVO in my code hence not able to