2013-09-30 68 views
0

我有一个UIViewController与内UINavigationViewController层次结构。当我对另一个视图控制器进行push-and-pop或者present-and-dismiss时,地图视图会刷新切片。我想在现在和结束之后避免让人耳目一新。我曾尝试:如何避免MKMapView刷新?

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

但地图视图剧照驳回后刷新砖...

回答

0

这是为了避免一个视图控制器上清爽的地图有道:

self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext; 
2

而不是重新创建每次你做SEGUE时候你MyModalViewController,把视图控制器为延迟加载实例变量和用它作为seque。这样它只设置一次,地图不会刷新。每当vc出现时,你仍然需要做任何设置和拆卸。