我有两个视图控制器,MapViewVC
并且MapDetailViewVC
.
我在MapView
.
当点击时,这些注释(具有特定的默认“高度”视图)会启动一个MapDetailVC
显示注释的快照,其中相机属性设置为确定的高度(4000 m)。
结果,当按下 上的“返回”按钮时MapDetailVC
,视图将返回到MapViewVC
与 ; 中显示的高度相同的高度MapDetailVC
。不是原始高度,这只是点击标注按钮时正在查看的区域。
我想知道(从那些更有经验的人MapKit
那里)是否有办法在mapView
点击“返回”按钮时将返回设置为原始设置。
谢谢
MapDetailViewController *mapDetail = [[self storyboard]
instantiateViewControllerWithIdentifier:@"MapDetailViewController"];
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Map"
style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;
Word *word = [[Word alloc] init];
word.name = biblicalPin.title;
MKMapCamera *myCamera = [MKMapCamera
cameraLookingAtCenterCoordinate:biblicalPin.coordinate
fromEyeCoordinate:biblicalPin.coordinate
eyeAltitude:2000];
mapView.camera = myCamera;
MKMapSnapshotOptions *options = [[MKMapSnapshotOptions alloc] init];
options.size = CGSizeMake(320, 140);
options.camera = myCamera;
options.scale = [[UIScreen mainScreen] scale];
options.region = self.mapView.region;
options.mapType = MKMapTypeSatellite;
MKMapSnapshotter *snapshotter =
[[MKMapSnapshotter alloc] initWithOptions:options];
[snapshotter startWithCompletionHandler:^(MKMapSnapshot *snapshot, NSError *e)
{
//if (e) ...;// Handle errors
UIImage *image = snapshot.image;
mapDetail.imageView.image = image;
mapDetail.currentWordDetail = word;
mapDetail.locationLabel.text = biblicalPin.title;
mapDetail.locationDescription.text = biblicalPin.information;
//[backButton --- add a method to return the user to the original mapView alititude.
}];
word.definition = biblicalPin.information;
[self.navigationController pushViewController:mapDetail animated:YES];