2016-02-22 91 views
0

我正在尝试显示活动指示符,同时更新用户的当前位置并注释注释。使用完整地址或邮政编码的搜索栏更新引脚时,活动指示器正常工作。在更新当前用户时没有显示活动指示灯位置(locationManager)

此外,我试图添加自我。在viewDidAppear acitivityIndi​​cator.startAnimation()(也)在FUNC:

func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { 
    if self.showMyLocation { 
     let locValue:CLLocationCoordinate2D = manager.location!.coordinate 
     print("locations = \(locValue.latitude) \(locValue.longitude)") 
     initialLat = locValue.latitude 
     initialLong = locValue.longitude 
     setInitialLocation() 
     self.showMyLocation = false 
    } 

} 

它需要时间来找到当前位置,但指标是直到没有出现。你知道为什么它是这样吗?

enter image description here

回答

0

您是否尝试过在你的编码的任何地方停止动画。 [activityIndi​​cator stopAnimating];

如果是,那么尝试在不停止你的活动指示灯

+0

我试图把它才开始运行你的代码,只有结束。但一旦func开始更新注释,屏幕冻结,这可能是为什么我不能看到动画。 – Stanislav