cs193p – Assignment #6 Task #4

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

The Recents tab should continue to meet all the requirements of the previous assignment. All Recents information should be stored in Core Data (i.e. do not use NSUserDefaults for Recents anymore).

… already done …

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #6 Task #3

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

Add a thumbnail image (FlickrFetcherPhotoFormatSquare) of each spot to every row in any table view that shows a list of spots. In addition …
a. Don’t ask Flickr for the image data of thumbnails that never appear on screen (i.e. fetch thumbnail image data only on demand).
b. Don’t block your main thread waiting for Flickr to give you a thumbnail’s data.
c. Never ask Flickr for the same thumbnail twice (cache the thumbnails’ data in your Core Data database).

To be able to display the thumbnail, we need its URL, which is currently missing in the core data 🙁 … add a new string attribute to the Photo entity, recreate its NSManagedObject subclass and set it in its category:

+ (Photo *)photoWithFlickrInfo:(NSDictionary *)photoDictionary
        inManagedObjectContext:(NSManagedObjectContext *)context
{
        ...
        photo.thumbnailURL = [[FlickrFetcher urlForPhoto:photoDictionary
                                                  format:FlickrPhotoFormatSquare] absoluteString];
        ...
}

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

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #6 Task #2 Part #3

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

Recreate the user-interface from last week’s assignment but rely entirely on the above-mentioned Core Data database to present it.

Copy the files for the last table view controller into the current project. Adjust it to setup the fetched results controller every time the view appears:

- (void)viewWillAppear:(BOOL)animated
{
    ...
    [self.sh useDocumentWithOperation:^(BOOL success) {
        [self setupFetchedResultsController];
    }];
}

Continue reading “cs193p – Assignment #6 Task #2 Part #3”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #6 Task #2 Part #2

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

Recreate the user-interface from last week’s assignment but rely entirely on the above-mentioned Core Data database to present it.

Copy the files for the second table-view controller from the previous project together with the image-view controller and the flicker cache class into the current project.

Change the table view controller to be a subclass of the core-data-table-view controller, and change the public property to be a Tag entity.

@interface FlickrPhotoTVC : CoreDataTableViewController
@property (nonatomic, strong) Tag *tag;

Continue reading “cs193p – Assignment #6 Task #2 Part #2”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #6 Task #2 Part #1

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

Recreate the user-interface from last week’s assignment but rely entirely on the above-mentioned Core Data database to present it.

Start by copying the content of story board for the iPhone of the previous SPoT project into the current project. Copy the class files for the first table-view controller of the first tab of the previous project together with the files for the network-activity indicator into the current project as well as the core-data-table-view controller from the demo of the lecture.

Define the table view controller as sub class of the ore-data-table-view controller:

@interface FlickrPhotoTagTVC : CoreDataTableViewController

Continue reading “cs193p – Assignment #6 Task #2 Part #1”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #6 Task #1

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

Create a Core Data-managed object database model in Xcode suitable for storing any information you queried from Flickr in the last assignment that you feel you will need to perform the rest of the Required Tasks in this assignment. Take the time to give some thought to what Entities, Attributes and Relationships your database will need before you dive in.

Following the recommendations of the assignment create a new blank universal single-view project. Create a new data model. Start by adding two new Entities “Photo” and “Tag” to hold the photos and its tags. Add a many-to-many relationship between them, because a photo can have multiple tags and a tag can have multiple photos.

The first table view should show the name of the tag and the number of photos it is associated with. Create a new string attribute for the tag entity to hold the name. The number of photos will be derived using its relationship to the photo tags.
Continue reading “cs193p – Assignment #6 Task #1”

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.

Sort all tables alphabetically (and case insensitively) except the Recents table (which should still be sorted with the most recently viewed first). A good solution to this might involve some of the array sorting methods that use blocks.

… actually the code up to this task already does sorting, but now it will be implemented using blocks.

For the tags create a new property – to do not have to resort everything every time the table needs to display a row:

@property (nonatomic, strong) NSArray *tags;
...
- (void)updatePhotosByTag
{
    ...
    self.tags = [[photosByTag allKeys] sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
        return [obj1 compare:obj2 options:NSCaseInsensitiveSearch];
    }];
}

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

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail