Advertisement
wkerswell

old code

Jan 31st, 2013
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (IBAction)BTNPinCar:(id)sender {
  2.     // locationManager update as location
  3.     locationManager = [[CLLocationManager alloc] init];
  4.     locationManager.delegate = (id)self;
  5.     locationManager.desiredAccuracy = kCLLocationAccuracyBest;
  6.     locationManager.distanceFilter = kCLDistanceFilterNone;
  7.     [locationManager startUpdatingLocation];
  8.     [locationManager stopUpdatingLocation];
  9.     CLLocation *location = [locationManager location];
  10.     // Configure the new event with information from the location
  11.  
  12.     float longitude=location.coordinate.longitude;
  13.     float latitude=location.coordinate.latitude;
  14.  
  15.     NSLog(@"dLongitude : %f", longitude);
  16.     NSLog(@"dLatitude : %f", latitude);
  17.  
  18.     [self pins:latitude lon:longitude];
  19.  
  20.     parked.latitude = latitude;
  21.     parked.longitude = longitude;
  22.  
  23.     //set the reigion to the coords and a mile distance
  24.     MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(parked, startZoom , startZoom );
  25.     //change the region and animate it
  26.     [MapView setRegion:viewRegion animated:YES];
  27.  
  28.  
  29.  
  30. }
  31.  
  32. - (IBAction)BTNFindCar:(id)sender {
  33.  
  34.     MKMapRect zoomRect = MKMapRectNull;
  35.     for (id <MKAnnotation> annotation in MapView.annotations)
  36.     {
  37.         MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate);
  38.         MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0.1, 0.1);
  39.         if (MKMapRectIsNull(zoomRect)) {
  40.             zoomRect = pointRect;
  41.         } else {
  42.             zoomRect = MKMapRectUnion(zoomRect, pointRect);
  43.         }
  44.     }
  45.     [MapView setVisibleMapRect:zoomRect animated:YES];
  46.  
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement