0

我有UIViewController一个MKMapView内部UINavigationViewController层次结构。当我向另一个视图控制器推送或呈现并关闭时,地图视图会刷新图块。我想避免在出席和解雇后刷新。我努力了:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // ...
    MyModalViewController * vc = segue.destinationViewController;
    vc.view.backgroundColor = [UIColor clearColor];
    self.modalPresentationStyle = UIModalPresentationCurrentContext;
    // ...
}

但是地图视图在关闭后仍然刷新图块......

4

2 回答 2

2

Instead of recreating your MyModalViewController every time you do the segue, put the view controller into a lazy-loaded instance variable and use that for the seque. That way it's only set up once and the map won't refresh. You'll still need to do whatever setup and teardown you need each time the vc appears.

于 2013-10-02T10:25:56.040 回答
0

这是避免在以前的视图控制器上刷新地图的正确方法:

self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext;
于 2014-02-07T10:13:42.127 回答