mkmapview

MKUserLocation Custom View not moving!

五迷三道 提交于 2019-12-21 04:25:20
问题 I have created a custom MKAnnotationView for User Location: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { if ([annotation isKindOfClass:[MKUserLocation class]]) { if (navStatus == NavStatusHeadingEnabled) { if ([annotation isKindOfClass:[MKUserLocation class]]) { locationView = [[CustomLocationView alloc] initWithAnnotation:annotation reuseIdentifier:@"locationIdentifier"]; return locationView; } } return nil; } CustomLocationView.h - (id

difference between desiredAccuracy and distanceFilter

偶尔善良 提交于 2019-12-21 04:16:07
问题 Sorry for being a noob here. I am not able to clearly differentiate between CLLocationManager's properties distanceFilter and desiredAccuracy . If I want my application to give different coordinates for even small distances (say 100-200 metres) what values should i set for these properties. Help would be greatly appreciated. 回答1: According to developer.apple.com distanceFilter The minimum distance (measured in meters) a device must move laterally before an update event is generated. That

How do I show multiple custom annotations (pin & left icon) loaded via plist?

筅森魡賤 提交于 2019-12-21 03:00:40
问题 will this code when working show custom pins and logos or just 1 pin with custom logos? please see plist below, only error is Local declaration of mapView hides instance variable. <plist version="1.0"> <array> <dict> <key>stationIdKey</key> <string>BP</string> <key>stationNameKey</key> <string>Atkinson Dam Cabin Village</string> <key>stationAddressKey</key> <string>Atkinson Dam Road, Atkinson Dam</string> <key>stationLatitudeKey</key> <string>-27.415056</string> <key>stationLongitudeKey</key>

MKMapView with custom MKAnnotation

北城以北 提交于 2019-12-21 02:51:34
问题 I've a MKMapView. I want to put a custom MKAnnotation on my map. They are some restaurant places. How can I do it? My question is how can I make a custom MKAnnotation? Thanks, guys. 回答1: If you totally want to customize the callout View of the annotation.. See this link.. http://blog.asolutions.com/2010/09/building-custom-map-annotation-callouts-part-1/ 回答2: First, let's define custom as meaning not simply title and subtitle. We want to change the size of the MKAnnotation and include some

Draw MKPolyline Fill Color

半世苍凉 提交于 2019-12-20 10:47:36
问题 I am attempting to draw a nice MKPolyline on an MKPolylineView . Everything is going great so far - the polyline draws just as I want it to and when I want it to using the following code: [[self map] addOverlay:routeLine]; And this method to tell the app how to draw it: - (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay { MKOverlayView* overlayView = nil; self.routeLineView = [[MKPolylineView alloc] initWithPolyline:[self routeLine]]; [[self routeLineView]

How do you check if an MKAnnotation is available within a MKCoordinateRegion

社会主义新天地 提交于 2019-12-20 09:47:26
问题 I've noticed that if I use MKMapView's selectAnnotation:animated: , that it will scroll my map off screen if the MKAnnotation is not displayed in the current MKCoordinateRegion that my map is displaying. Is there a trivial way to check if an annotation is currently on screen within the specified MKCoordinateRegion? I'd like to be able to select an annotation that's only on screen and not something offscreen. 回答1: Use the annotationsInMapRect: method in the MKMapView class. It returns a NSSet

Handling large quantity of MKMapView Annotations

泄露秘密 提交于 2019-12-20 09:20:58
问题 I have a map view with a large quantity of annotations (3000+), when the user is zoomed to a reasonable level all is well and fast. Although when the user zooms out and a large quanitiy of annotations come into view there is a lot of slow down due to the sheer amount of annotations being shown at once. What is the best way to handle this? The current solution i am using: - (void)mapView:(MKMapView *)_mapView regionDidChangeAnimated:(BOOL)animated { NSArray *annotations = [_mapView annotations

MKMapView Route/Directions

ε祈祈猫儿з 提交于 2019-12-20 08:32:43
问题 I found that the Google Maps API supports Directions through: var map; var directionsPanel; var directions; function initialize() { map = new GMap2(document.getElementById("map_canvas")); directionsPanel = document.getElementById("my_textual_div"); map.setCenter(new GLatLng(49.496675,-102.65625), 3); directions = new GDirections(map, directionsPanel); directions.load("from: 500 Memorial Drive, Cambridge, MA to: 4 Yawkey Way, Boston, MA 02215 (Fenway Park)"); } So how can this be translated

IBOutlet variables return nil when I try to access them. Error: Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value

為{幸葍}努か 提交于 2019-12-20 07:40:19
问题 I have a UIViewController that implements MGLMapViewDelegate . I'm trying to place a nav bar at the top, with two buttons. I couldn't get my buttons or nav bar visible so I tried using the function view.bringSubviewToFront() within my viewDidLoadFunction() as suggested on this post When I did this, I received the error Error: Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value I don't understand how the IBOutlet variables can ever be nil, I thought they were

“EXC_BAD_ACCESS” when switch too fast between an tableView and a mapView

天涯浪子 提交于 2019-12-20 06:10:04
问题 I have a tableView with an button to push a mapView. The push and back actions generally work fine. If I switch quickly between these two views, "EXC_BAD_ACCESS" error will appear. MapViewController.m - (void)viewDidLoad { [super viewDidLoad]; self.mapView.delegate = self; UIButton *btnL = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40.0, 40.0)]; [btnL setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal]; [btnL addTarget:self.navigationController action:@selector