开发者

How to have progress bar with time remaining when writing files?

开发者 https://www.devze.com 2023-01-28 17:53 出处:网络
Is it possible 开发者_如何学Pythonto have a progress bar that displays the progress of writing a large file(s) to disk that also displays the estimated overall time remaining? Found alot of code re UR

Is it possible 开发者_如何学Pythonto have a progress bar that displays the progress of writing a large file(s) to disk that also displays the estimated overall time remaining? Found alot of code re URL requests but none for writing files to disk. I am trying to display the progress for unzipping a zip file to disk.

Thx


The provided APIs for writing files to disk do not give any callbacks to inform the program of the progress of the write. You'll probably have to write your own file writing code to get that functionality.

What you can do is to do the writing in the background, away from your main thread so you do not block the UI.

You can do this using blocks or using NSOperation & NSOperationQueue (The usage of which is for another question).

When you do this work in the background, you can display an indeterminate progress indicator such as a spinner. You still won't be able to know the progress, though, only that it is in progress.

0

精彩评论

暂无评论...
验证码 换一张
取 消