Assignment #5 Task #6

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

When a map view of photos appears on screen, its region should be set to the minimum size that fits all of its annotations (with an aesthetically-pleasing padding around them).

First iterate over all annotations and save the minimum and maximum values for longitude and latitude. Next create a region and set its center and size using this variables. To get the aesthetically-pleasing padding increase the size of the region by 10 %. If there is only on annotation the size would be zero, which can be prevented by randomly set it to a square of one by one degrees.
Continue reading “Assignment #5 Task #6”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Assignment #5 Task #5

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

Anywhere in your application where a list of photos or places appears, give the user an option (via some UI of your choice) to view information in the list on a map instead. Each annotation on the map should have a callout which displays the following:
a. The title of the photo or the name of the place.
b. In the case of a photo, its description (at least the first few words of it, if any) and a thumbnail image (FlickrFetcherPhotoFormatSquare) of the photo. It is okay if the callout shows up initially without the thumbnail, but as soon as you are able to retrieve it from Flickr (assuming the callout is still on screen at that point), the thumbnail should appear. Beware Required Task #1.
c. A disclosure button which brings up the full image of the chosen photo (exactly as if the user had chosen the photo from a table) or which brings up a list of photos in that place (again, exactly as if the user had chosen that place from a table).

First we start by adding a button to the navigation toolbar to allow displaying a map and a second one for displaying the table again when the map is on screen. Because we will need this functionality in all tables we will put this code into the common-table-view-controller class:
Continue reading “Assignment #5 Task #5”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Assignment #5 Task #4

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

Keep as little of the photos’ image data in memory (i.e. RAM) as you can (i.e. don’t keep strong pointers to NSData and/or UIImage objects for photos that are not on- screen). You should have at most 2 photos’ image data in memory at a given time, preferably only 1 (or even 0 if none are being viewed).

The current code up to this task does not keep any strong pointers to NSData or NSImage objects as the image is only stored in the image view. Because the iPad uses a single image view there is at most only one image in memory. The iPhone has tow image views thus there could be two images in memory.
Continue reading “Assignment #5 Task #4”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Assignment #5 Task #3

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

Cache photo images viewed by the user into files in your application’s sandbox. Each photo’s image should be a separate file in the sandbox. Limit the cache to about 10MB total. When this limit is reached, the oldest photos in the cache should be evicted (deleted) to make room for new photos coming in. Your application should never query Flickr for the image data for a photo that it has in its cache (obviously). This cache should persist between application launches.

For the caching functionality we create a new class providing three public methods:

+ (FlickrCache *)cacheFor:(NSString *)folder;
- (NSURL *)urlForCachedPhoto:(NSDictionary *)photo format:(FlickrPhotoFormat)format;
- (void)cacheData:(NSData *)data ofPhoto:(NSDictionary *)photo format:(FlickrPhotoFormat)format;

Continue reading “Assignment #5 Task #3”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

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.
Continue reading “Assignment #5 Task #2”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Assignment #5 Task #1

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

The fifth assignment continues the application from the last assignment which create a navigation-based application to let users browse photos by looking in the most popular Flickr locations, then click on any they are interested in to see a photo of it. This assignment will fix problems with the responsiveness of the user-interface by using GCD to move blocking activity out of the main thread and by cacheing the image data received from Flickr. In addition, some maps will be added and the application will become Universal.

Your application must implement all the required tasks from the last assignment (and all the required tasks in this assignment) without doing any Flickr fetching or file system interactions in the main thread. Your user-interface should be responsive to the user at all times (i.e. the main thread should never be blocked).

Continue reading “Assignment #5 Task #1”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail