我有一个 UIViewController
,在 UINavigationViewController
层次结构中有一个 MKMapView
。当我向另一个 View Controller 推送并弹出或呈现并关闭时, map View 会刷新图 block 。我想避免在提交和解雇后刷新。我试过:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// ...
MyModalViewController * vc = segue.destinationViewController;
vc.view.backgroundColor = [UIColor clearColor];
self.modalPresentationStyle = UIModalPresentationCurrentContext;
// ...
}
但是 map View 在关闭后仍然会刷新图 block ...
最佳答案
与其在每次执行 segue 时都重新创建 MyModalViewController,不如将 View Controller 放入延迟加载的实例变量中,并将其用于 seque。这样它只设置一次并且 map 不会刷新。每次出现 vc 时,您仍然需要进行所需的任何设置和拆卸。
关于ios - 如何避免 MKMapView 刷新?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19099833/