Assignment #4 Task #10

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

The recents tab must show the list of most recently view photos in chronological order of viewing with the most recent at the top, and no duplicates in the list. It is sufficient to only update the list each time it (re)appears on screen (i.e. in viewWillAppear:). A photo can be uniquely identified by its “id” entry in its dictionary.

Create a model for the recents list, holding data for the recent photos:

@property (nonatomic, strong) NSArray *photos;

Synthesize the model and set its setter to reload the table when the data has changed:
Continue reading “Assignment #4 Task #10”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Assignment #4 Task #9

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

Your application must work in both portrait and landscape orientations on the iPhone. Support for the iPad is optional (though it will be required next week, so you can save time later by implementing it now). Use appropriate platform-specific UI idioms (e.g., you must use UINavigationControllers to present the information on the iPhone).

We start by allow auto rotation in the common-table-view-controller class and the photo-view-controller class:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}

Continue reading “Assignment #4 Task #9”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Assignment #4 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 initially be zoomed to show as much of the photo as possible with no extra, unused space. It is not necessary to continue to do this as the user rotates the device or zooms in and out on the photo by pinching.

To solve that we check what the zoom scales would be when we would display the complete width or height of the image, and set the actual scale to the larger value:

    double wScale = self.scrollView.bounds.size.width / image.size.width;
    double hScale = self.scrollView.bounds.size.height / image.size.height;
    if (wScale > hScale) self.scrollView.zoomScale = wScale;
    else self.scrollView.zoomScale = hScale;

The complete code for this task is available at github.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Assignment #4 Task #7

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

Make sure the photo’s title is somewhere on screen whenever you are showing the photo image to the user.

Currently we have put some common code for handling and formatting data from FlickrFetcher into the common-table-view-controller class. Now we need this code also in a generic view controller. Thus we need to move that part into a more generic helper class and change those methods to class methods.

Now we can easily set the title of the window using the class method of our “new” generic helper class.

    self.navigationItem.title = [FlickrData titleOfPhoto:self.photo];

The complete code for this task is available at github.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Assignment #4 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, display its image 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: (use Large).

Inside your iPhone story board drag out a new view controller, add a scroll view and inside an image view. Create a new class for the view controller and connect outlets for the scroll and image view.

Now create a model to hold the photo data:
Continue reading “Assignment #4 Task #6”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Assignment #4 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.

Similar to task #3 we create two helper functions:
Continue reading “Assignment #4 Task #5”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Assignment #4 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 from the list obtained in Required Task #1, you must query Flickr again to get an array of 50 recent photos from that place and display them in a list. Do this using the FlickrFetcher method photosInPlace:maxResults: (it returns an array of dictionaries, each of which contains info about a photo).

In the iPhone storyboard we add a new table view controller, add a new class for it and set it in storyboard. From the cell inside the top-places table view controller create a push segue to the new table view controller. Don’t forget to set the style and the reuse identifier of the cell of the new table view controller.
Continue reading “Assignment #4 Task #4”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail