隐藏UIProgressView提取PHAsset完成后,进度完成animation

我正在执行一个请求,以获得一个PHAsset的图像资产,而且我正在使用UIProgressView来使用progressHandler PHImageRequestOptions允许我提供的progressHandler 。 当这个处理程序被调用时,它提供了progress所以我在进度视图上设置了进度,但是我也通过setProgress:animated:设置了这个新进度的setProgress:animated: 我现在需要弄清楚一旦进度达到了1.0,如何隐藏进度视图,但是直到它完成animation到1.0为止。

例如,它可能开始下载资产,用0.2调用进度callback,然后下一个callback可能是1.0。 如果我一收到1.0就隐藏进度条,用户就不会看到1.0的animation,它可能在0.7时消失。

我的问题是,我怎么知道什么时候它已经完成了新的进度值的animation,因此知道什么时候隐藏进度视图?

 let options = PHImageRequestOptions() options.networkAccessAllowed = true options.progressHandler = { (progress: Double, _, _, _) -> Void in dispatch_async(dispatch_get_main_queue()) { self.barProgressView.setProgress(Float(progress), animated: true) //FIXME: Can't do this, otherwise it will hide before animation completes self.barProgressView.hidden = (progress <= 0.0 || progress >= 1.0) } } PHImageManager.defaultManager().requestImageForAsset(photoAsset, targetSize: targetSize, contentMode: .AspectFit, options: options) { (result: UIImage?, info: Dictionary?) -> Void in //do something with the image }