mapkit

How I can center the map on user's location in swift?

烈酒焚心 提交于 2020-02-03 04:49:09
问题 I'm writing an app and I have an embedded mapview to show user's his location. This is my code so far: class YourCurrentLocation: UIViewController, CLLocationManagerDelegate { @IBOutlet weak var mapView: MKMapView! var locationManager = CLLocationManager() let regionRadius: CLLocationDistance = 1000 func checkLocationAuthorizationStatus() { if CLLocationManager.authorizationStatus() == .AuthorizedWhenInUse { mapView.showsUserLocation = true centerMapOnLocation(locationManager.location!, map:

Smooth resizing of MKCircle

风格不统一 提交于 2020-01-30 04:27:45
问题 How can I achieve a smooth resizing of a MKCircleView on a UIMapView when adjusting an NSSlider? Apple has managed to do it in the Find my friends app when creating geofences (http://reviewznow.com/wp-content/uploads/2013/03/find-my-friends-location-alerts-01.jpg), so I guess it's possible in some way. So far I've tried the following solutions, but with a very "flickery" result: First attempt I added a new MKCircleView with an updated radius and immediately after removing the one that was (as

ios mapkit closing annotation callouts by tapping the map

六眼飞鱼酱① 提交于 2020-01-29 07:57:25
问题 I've got a mapkit app that places annotations on the map, when you press them, it shows the callout with the title attribute. This works fine, but the user cannot close them. They stay open until they tap another annotation. Can't I make it that the user can tap elsehwere on the map (or tap the annotation again) to close it? I had a feeling this was the default setting, so perhaps something I'm doing is stuffing it up? I have a gesture recognizer which I use to detect some map taps

ios mapkit closing annotation callouts by tapping the map

≡放荡痞女 提交于 2020-01-29 07:55:47
问题 I've got a mapkit app that places annotations on the map, when you press them, it shows the callout with the title attribute. This works fine, but the user cannot close them. They stay open until they tap another annotation. Can't I make it that the user can tap elsehwere on the map (or tap the annotation again) to close it? I had a feeling this was the default setting, so perhaps something I'm doing is stuffing it up? I have a gesture recognizer which I use to detect some map taps

ios mapkit closing annotation callouts by tapping the map

流过昼夜 提交于 2020-01-29 07:54:53
问题 I've got a mapkit app that places annotations on the map, when you press them, it shows the callout with the title attribute. This works fine, but the user cannot close them. They stay open until they tap another annotation. Can't I make it that the user can tap elsehwere on the map (or tap the annotation again) to close it? I had a feeling this was the default setting, so perhaps something I'm doing is stuffing it up? I have a gesture recognizer which I use to detect some map taps

Detect closest annotation pin

試著忘記壹切 提交于 2020-01-25 15:24:14
问题 I want to detect which annotation pin is the closest to the current location of the user. I already added the annotation pins. How would you do this? 回答1: This is all from memory - but I think this should do the trick: - (MKPointAnnotation *)cloestAnnotation { // create variables you'll use to track the smallest distance measured and the // closest annotation MKPointAnnotation *closestAnnotation; CLLocationDistance smallestDistance = 9999999; // loop through your mapview's annotations (if you

Unrecognized selector sent to instance?

半世苍凉 提交于 2020-01-25 07:58:07
问题 How to fix such an error: unrecognized selector sent to instance ? CLLocationCoordinate2D userCoordinate = userLocation.location.coordinate; CGFloat latDelta = rand()*.035/RAND_MAX -.02; CGFloat longDelta = rand()*.03/RAND_MAX -.015; CLLocationCoordinate2D newCoord = { userCoordinate.latitude + latDelta, userCoordinate.longitude + longDelta }; myPoint *mp = [[myPoint alloc] initWithCoordinate:newCoord title:[NSString stringWithFormat:@"Vitaliy Home %d",i] subTitle:@"Home Sweet Home"]; [mv

Preventing annotation deselection in MKMapView

爷,独闯天下 提交于 2020-01-25 02:56:32
问题 I have a situation in my app where I want to disable annotation deselection (other than when selecting another), so when I tap anywhere that is not an annotation view, it should leave the currently selected annotation as is. If I tap on another annotation view, it should select that one and deselect the other. I was hoping to find something along the lines of a willDeselectAnnotationView in the MKMapViewDelegate or an isDeselected in MKAnnotationView , but there's unfortunately no such thing.

GLKViewControllerDelegate getting blocked

放肆的年华 提交于 2020-01-24 02:53:07
问题 I have a GLKViewController to handle some OpenGL drawing. I have the glkView:drawInRect and update method both implemented and have the preferredFramesPerSecond property set to 30 (the default). The problem is that the delegate methods stop firing when the user interacts with other part of the app. The two cases that I have seen this happen on is when the user scrolls a UITableView or interacts with a MKMapView. Is there a way to make sure these delegates always fire, regardless of what the

Mapkit UserLocation found event

限于喜欢 提交于 2020-01-24 01:20:11
问题 Is there an event that gets fired when a users location is successfully found in the iPhone mapkit? I want to call a web service at the time the current location pin is dropped onto the map. 回答1: You'll need to create CLLocationManger object and call startUpdatingLocation method. Once the location is found and updated, CLLocationMangerDelegate method - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation will