Assignment #5 Task #2

Please note, this blog entry is from a previous course. You might want to check out the current one.

If the user is waiting for something (other than a thumbnail) to update in a view, display a UIActivityIndicatorView (spinning wheel) somewhere appropriate until it fills in (the network activity indicator in the little status bar at the very top of the screen is not an acceptable substitute for this). The user interface should be completely responsive while a wheel is spinning (e.g. the user could hit the back button or a tab and navigate away from the spinning wheel if so desired). Also, the user- interface should never “navigate” except directly in response to a user action.

For the table view controllers we setup the common-table-view-controller class to generate a spinner button and place it in the right hand corner of the toobar.

//  CommonTableViewController.h
@property (nonatomic, strong) UIActivityIndicatorView *spinner;

//  CommonTableViewController.m
@synthesize spinner = _spinner;

- (void)viewDidLoad
    [super viewDidLoad];
    self.spinner = [[UIActivityIndicatorView alloc] 
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]

Activate this spinner in the top-places and top-photos table view controllers before you access Flickr and stop it as soon the model has been updated:

[self.spinner startAnimating];
[self.spinner stopAnimating];

For the photo view controller we could us a similar way, however for fun, we choose a different solution. In both storyboards place an activity indicator view on top of the image view and create an outlet to which both storyboards connect. Depending on which kind of style you use, it might be necessary to adjust the background color of the image and the scroll view so that the user is actually able to see it. It improve that we additionally make the current image (if there is one) transparent:

if (self.imageView.image) self.imageView.alpha = 0.5;
[self.spinner startAnimating];    
self.imageView.alpha = 1;
[self.spinner stopAnimating];

The complete code for this task is available at github.


Leave a Reply

Your email address will not be published.