mkmapview

can't set zoom level on MKMapView

南楼画角 提交于 2020-01-05 08:04:19
问题 i am adding MKCircleView to the user annotation like so : - (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation { if (!_MapCentered) { **_circle = [MKCircle circleWithCenterCoordinate:userLocation.coordinate radius:3000]; [_map_view addOverlay:_circle];** _MapCentered = YES; } } it will fire once and once the user location has traced, it works well but as you can see the diameter of the circle view is 3000 meters. so now i want the zoom level to fit the

Can't Get Coordinates From MKMapView Using UILongTouchGestureRecognizer

ぐ巨炮叔叔 提交于 2020-01-05 07:38:16
问题 I'm using iOS 6, and I've read dozens of ways to accomplish this (including many from stack overflow) without success. Here's what I've tried, separated into "stages": Create a UILongTouchGestureRecognizer to receive long touches for the MKMapView . I've tried adding a UILongTouchGestureRecognizer via my Storyboard, and hooking up the outlets, delegates, etc. through the Connections Inspector. I've tried creating the UILongTouchGestureRecognizer programmatically, initializing it using mapView

MKMapView change colors

自作多情 提交于 2020-01-05 07:16:15
问题 Anyone know of a way to change the colors of a MKMapView? Is there a way to XOR an image over or blend one that you could "possibly" create a "night version" of the map that isn't so bright? Thanks! Dan 回答1: better solution would be to add custom colored overlays 回答2: I guess you could create a UIView with a 50% alpha that covered the MKMapView, but then you will have UI problems. I am assuming the Satellite mode doesn't suit? 回答3: What I ended up doing is adding a MKAnnotation with a 50%

Show custom and default callout views on different pins with pin clustering on map view

风流意气都作罢 提交于 2020-01-05 06:02:51
问题 This is my first question, and i am new to iOS. I am implementing pin clustering on map view , which in working fine for one type of pin but my requirement is to cluster different kind of pins with different cluster count on it when zoomed out i.e if one kind of pin shows river details on map view than these pins should cluster together and give a count on it and on other case if other pin is showing details for diversion on map view than these pins should cluster together separately from

How can I set MKMapView's region span dynamically so that it doesn't “snap” back to the initial Region upon redrawing the map?

萝らか妹 提交于 2020-01-05 04:42:15
问题 I am working with a MKMapview and I am having a problem with the zoom level and the region span. It would seem when the MKMapView is refreshed it resets the region to the values that have been hardcoded when I initially installed them. I am keeping track of the user's location and with any changes in the location of the phone the map should update via the CLLocationManagerDelegate and the delegate method listed below. Currently I have this in the locationManager:didUpdateToLocation

Moving MKCircle on MKMapview and dragging MKMapview

萝らか妹 提交于 2020-01-04 14:28:12
问题 I have a MKCircle on MKMapView. It is user-draggable, but if the user drags the area outside the circle, the map should be moving instead. - (IBAction)createPanGestureRecognizer:(id)sender { _mapView.scrollEnabled=NO; _panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(respondToPanGesture:)]; [_mapView addGestureRecognizer:_panRecognizer]; } -(void)respondToPanGesture:(UIPanGestureRecognizer*)sender { static CGPoint originalPoint; if (sender.state ==

removing/adding annotations to mapview cause memory leaks

时光怂恿深爱的人放手 提交于 2020-01-04 09:24:31
问题 I've been trying to get rid of memory leaks in mapview. I am using custom map pin class. Everything works, but problem is - I need to filter mapview results. when i remove all mapview annotations - and add filtered results - performance tool finds leaks. but in this mapPin class I am using are used autorelease, so they should be released, but they aren't. what am I doing wrong? MapPin.h #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> #import <MapKit/MKMapView.h> #import <MapKit

How to get location services to reprompt the user for location permission if they accidentally refused it?

亡梦爱人 提交于 2020-01-04 06:08:18
问题 When the users are asked to allow the user location, if they select accidentally "NO", then this alert is never shown in our app. Is there any option to reprompt the alert every time they open the app.After referring S.O question, many are suggesting this not all possible.Only thing can be do is, we have alert the user to turn-on location service in settings. But in some S.O questions, starting CLLocationManager update method every time based on the user's selection we can reprompt the alert

MKViewMap custom annotation disappears on click

放肆的年华 提交于 2020-01-04 05:15:39
问题 I'm creating custom annotation for MKMap. It's work, but when I click on an annotation, the annotation disappears (see image), then the callout show and disappears too. (I have done this tutorial https://www.raywenderlich.com/90971/introduction-mapkit-swift-tutorial) Here the custom annotation : `class Trail: NSObject, MKAnnotation { let title: String? let difficulty: String let coordinate: CLLocationCoordinate2D var enableInfoButton : Bool init(title: String, difficulty: String, coordinate:

Setting MKMapView Zoom level to a locality

五迷三道 提交于 2020-01-04 03:46:00
问题 I wish to set the zoom level (OR set region) of MKMapView such that I can show a locality. Elaborating my context with an example. I have a location (CLLocation *) of which I found out the locality using CLGeocoder (reverse geocoding). Now, say the locality is 'Cupertino, CA' area. How do I find the region that completely encloses Cupertino in MKMapView? Thank you. 回答1: Create MKCoordinateRegion object and set map view region for that: CLLocationCoordinate2D location =