Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (IBAction)BTNPinCar:(id)sender {
- // locationManager update as location
- locationManager = [[CLLocationManager alloc] init];
- locationManager.delegate = (id)self;
- locationManager.desiredAccuracy = kCLLocationAccuracyBest;
- locationManager.distanceFilter = kCLDistanceFilterNone;
- [locationManager startUpdatingLocation];
- [locationManager stopUpdatingLocation];
- CLLocation *location = [locationManager location];
- // Configure the new event with information from the location
- float longitude=location.coordinate.longitude;
- float latitude=location.coordinate.latitude;
- NSLog(@"dLongitude : %f", longitude);
- NSLog(@"dLatitude : %f", latitude);
- [self pins:latitude lon:longitude];
- parked.latitude = latitude;
- parked.longitude = longitude;
- //set the reigion to the coords and a mile distance
- MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(parked, startZoom , startZoom );
- //change the region and animate it
- [MapView setRegion:viewRegion animated:YES];
- }
- - (IBAction)BTNFindCar:(id)sender {
- MKMapRect zoomRect = MKMapRectNull;
- for (id <MKAnnotation> annotation in MapView.annotations)
- {
- MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate);
- MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0.1, 0.1);
- if (MKMapRectIsNull(zoomRect)) {
- zoomRect = pointRect;
- } else {
- zoomRect = MKMapRectUnion(zoomRect, pointRect);
- }
- }
- [MapView setVisibleMapRect:zoomRect animated:YES];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement