在SecondViewController的MapView上显示当前位置

时间:2016-01-04 06:33:38

标签: ios objective-c xcode

我正在开发一款具有地图功能的应用。 我有两个视图控制器都有mapview,我能够在按钮点击FirstViewController时显示当前位置。现在,我想在SecondViewController而不是FirstViewController上显示此位置。看看我的按钮点击代码。 Plz帮助

`

FirstViewController.m


 -(IBAction)btnMylLocation:(UIButton *)sender {


     CLLocationCoordinate2D coord = {.latitude =  18.4897587, .longitude =  73.8202962};
     MKCoordinateSpan span = {.latitudeDelta =  1.00f, .longitudeDelta =  1.00f};
     MKCoordinateRegion region = {coord, span};
     [self.mapView setRegion:region];
     CLLocationCoordinate2D annotationCoord;
     annotationCoord.latitude = 18.4897587;
     annotationCoord.longitude = 73.8202962;
     self.lblLongitude.text = [NSString stringWithFormat:@"%f ", annotationCoord.latitude];
     self.lblLatitude.text = [NSString stringWithFormat:@" %f", annotationCoord.longitude];
     MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];
     annotationPoint.coordinate = annotationCoord;
     annotationPoint.title = @"Mindbowser";
     annotationPoint.subtitle = @"Pune Headquater's";
     [_mapView addAnnotation:annotationPoint];

  }

`

0 个答案:

没有答案
相关问题