我正在开发一款具有地图功能的应用。
我有两个视图控制器都有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];
}
`