Re: Best practice with NSProgressIndicator
site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1501279200; bh=1xjkKHh0FERWgtxsj3dtqQKUfp6M9UCcfaXhHi/B5Jo=; h=Content-type:MIME-version:Subject:From:Date:Message-id:To; b=FCI5uavNCzyxldNwNtyJSZ18LQjSC161JkTpm3TK+sRe2qkoeipUU90DcsfNTFbUR ZGbe7ZlEcTd5QzcUvZBVJp5Tk5mVjjl/qjCee9iCrGDgarNWKK+HI+jEtoKEAgeoRZ cgrdXErAdOK/jxx1B+qUbz5mviQZg1cOqXUHo2jaQgKI6AdqtDhL5m2+2WKGaV6hHU OGrwtfj/wHyo8gNbCa+XwD/8L2/XksJi/2q7pcIXPHuTmRX/XWcm0OpqBhGwu7uucD laIyZjiMDyxI5BBe5ZqaGsHkNsqQqhOtacTyPf7ydaq1efD/wkcRMqj8l9ll47K/fK YFDNHNeoLAOHQ== Use MBProgressHUD. It has much better options for deterministic and indeterminate progress indicators. I have been using it since 2011 or 2012. There are several factors that many people are unaware of in that if the operation completes in under .75 seconds, you do not want to display the progress indicator, but if it takes longer, you must show it for a minimum period of time of 1.25 seconds. If you do not do this, it will flash on the screen for a short time and look odd to the user. Sent from my iPhone
On Jul 28, 2017, at 8:57 AM, Mark Allan <markjallan@gmail.com> wrote:
Hi all,
I'm wondering if anyone has any thoughts about or links to best practices when using determinate NSProgressIndicators.
I have an app with a helper tool that performs some lengthy process in a loop and reports progress to the user. It works out how many iterations of the loop will be needed, sets the progressbar.maxValue, and then increments the progress bar's value on each iteration.
The consumes a large amount of CPU time just for updating the progress bar, so I'd like to cut down how often I update it.
Setting the max value to 100 and only updating 100 times (i.e. as a percentage) seems too infrequent because the loop can iterate more than a million times.
I'm debating doing it with an NSTimer firing every second, but wondered if anyone had any other suggestions?
What are people's thoughts?
I've tried searching online and the only problems/solutions I can see are all related to people's progress bars not updating properly because they're blocking the main thread etc. I can't see anything related to best practice.
Many thanks Mark
PS. It could be that this is a case of premature optimisation...but I don't think so! _______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
This email sent to zav@mac.com
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Alex Zavatone