gpt4 book ai didi

iphone - FlipView 关闭后如何刷新 View

转载 作者:行者123 更新时间:2023-11-29 04:19:26 25 4
gpt4 key购买 nike

我有一个带有不同引脚的 map View 。我还有一个 FlipView,您可以在其中打开或关闭引脚。

我的问题是,当 filpView 被关闭时,添加图钉的函数不会再次运行,因此相同的图钉保留在 map 上。

有没有办法再次运行 viewDidLoad 函数或者有更好的方法来更改引脚?

这是我的 Code对于这两种观点。

感谢您的帮助。

最佳答案

viewWillAppear: 方法中添加 Pin 图并分派(dispatch) localMap 方法,如下所示

-(void)viewWillAppear:(BOOL)animated{

NSArray *ann = [yourMapView annotations];
[yourMapView removeAnnotations:ann];
[self addPins];
//force the map to start on the main queue
dispatch_async(dispatch_get_main_queue(), ^{[self localMap];});
}

关于iphone - FlipView 关闭后如何刷新 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13158531/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com