cs193p – Assignment #5 Task #9

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

Your application’s main thread should never be blocked (e.g. Flickr fetches must happen in a different thread). If your application is waiting for something over the network, it should give feedback to the user that that is happening.

… we took already care of that, too …

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #5 Task #8

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

Whenever a photo’s image appears on screen, it should automatically zoom to show as much of the photo as possible with no extra, unused space. Once the user zooms in or out on a photo by pinching, though, you can stop auto-zooming that image.

Instead of setting the zoom scale to a constant value, it needs to be calculated. The scale to fit an image horizontally is calculated by dividing the bounds width of the scroll view by the width of the image. The same would have been true for the vertical scale, using the heights of those values, if the scroll view did not extend over the tab bar, the navigation bar and the status bar. Their heights need to be used to adjust the calculation for the vertical scale. Just set the the zoom scale of the scroll view to the higher of those two calculated scales:
Continue reading “cs193p – Assignment #5 Task #8”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #5 Task #6

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

When the user chooses a photo from any list, show it inside a scrolling view that allows the user to pan and zoom (a reasonable amount). You obtain the URL for a Flickr photo’s image using FlickrFetcher’s URLForPhoto:format:.

Start by adding a new view controller to storyboard. Add a scroll view and an activity indicator (you might want to change the color of the later one). Add push segues from the cells of the last table view controllers of both tabs to the new controller (and name them):

cs193p – assignment #5 task #6 - image view controller
cs193p – assignment #5 task #6 – image view controller

Continue reading “cs193p – Assignment #5 Task #6”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #5 Task #5

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

Any list of photos should display the photo’s title as the table view cell’s title and its description as the table view cell’s subtitle. If the photo has no title, use its description as the title. If it has no title or description, use “Unknown” as the title. Flickr photo dictionary keys are #defined in FlickrFetcher.h.

Create two new helper methods. For the title if there is one return the title photo, otherwise if there is a description return it, or if both do not exist return “Unkown”. For the subtitle check the title first. If is set to “Unkown” or the description of the photo, return an empty string. Otherwise return the description:
Continue reading “cs193p – Assignment #5 Task #5”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #5 Task #4

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

When the user chooses a place in a table view, you must query Flickr again to get an array of 50 photos from that place and display them in a list. The URL provided by FlickrFetcher’s URLforPhotosInPlace:maxResults: method will get this from Flickr.

Create a new class derived from the table-view-controller class to be used to show a list of photos with a public property to hold an array of photos:

@property (nonatomic, strong) NSArray *photos; // of Flickr photos NSDicitionary

Continue reading “cs193p – Assignment #5 Task #4”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #5 Task #3

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

Anywhere a place appears in a table view in your application, the most detailed part of the location (e.g. the city name) should be the title of the table view’s cell and the rest of the name of the location (e.g. state, province, etc.) should appear as the subtitle of the table view cell. The country will be in the section title.

In the Flickr helper class add a couple of new public instance methods which will handle the interface with Flickr:

+ (NSString *)countryOfPlace:(NSDictionary *)place;
+ (NSString *)titleOfPlace:(NSDictionary *)place;
+ (NSString *)subtitleOfPlace:(NSDictionary *)place;
+ (NSArray *)sortPlaces:(NSArray *)places;
+ (NSDictionary *)placesByCountries:(NSArray *)places;
+ (NSArray *)countriesFromPlacesByCountry:(NSDictionary *)placesByCountry;

Continue reading “cs193p – Assignment #5 Task #3”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail