MBProgressHUD: When you simply have to make users wait
Code Quality: Production
Making users cool their heels in your app is never a good idea, but sometimes it just can’t be avoided. Unless your app is completely self-contained or operates on trivially small amounts of data, you have to get your data from somewhere. And, more than likely you will eventually have a situation where the very act of getting that data from some place off the Internet will take a few seconds…
Of course iOS users are a notoriously impatient bunch(*), they hate user interfaces that either don’t work, or worse, appear to lock up while the app goes off and does something in the background. If you have to make your users wait around while you fetch data or complete some other lengthy task, a good way to keep them aprised of what you’re doing is to deploy some kind of progress indicator that shows the user whats going on, and, hopefully how quickly the operation will be over and they can get down to using your cool app.
Of course, you could create such a progress indicator from scratch, but here at MacIndie our goal is to help you get stuff done faster and not spend your valuable time re-inventing features that have already been done by others whereever possible. In the “progress bar” space there are several such open source packages available, but one of the slickest is a little kit called “MBProgressHUD” written Jonathan George.
MBProgressHUD is a very tiny view controller class that you can use for everything form simple activity indications (like the a large format version of the network activity spinner that shows up in the status bar), to a series of changing animations that you can update as you fetch and process data (as in the screen shot shown here).
Setting it up couldn’t be easier, you merely instantiate an instance of the MBProgressHUD telling it what view it should float above, and then give the the name of a selector it should fire up on a new thread in order to send updates to the HUD to change its appearance as needed. 1-2-3, easy-peasy. Nuthin’ to it, and there you have it a painless activity indicator class for your iOS apps.
With apologies to Louis CK “..give it a second, …it’s going to SPACE!”