cs193p – Assignment #4 Task #9 & #10

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

Since all the lists you display allow further navigation, they should display a disclosure indicator in every cell (Xcode will automatically add this for you when you create a segue from a table view cell).

… if you would like to adjust it yourself you could do so in storyboard using the inspector to set the accessory to disclosure indicator, or set it in code:

cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

This application must work properly in both portrait and landscape modes on the iPhone 4 and iPhone 5. It is extra credit to also do the iPad, but the iPhone version is required.

… it does 😉

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #4 Task #8

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

The recents tab must show a list of the most recently view photos in order, with the most recent at the top and no duplicates in the list. The list of recents must also persist across application termination and relaunch. When a recent photo in the list is chosen, it should navigate to a view of the photo in the same way as other table views in the application do. Limit the size of the list to a reasonable number.

Create a new class derived from NSObject to handle saving and storing the recent photos. Create a public interface to get all photos and to set a new photo:

+ (NSArray *)allPhotos;
+ (void) addPhoto:(NSDictionary *)photo;

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

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #4 Task #6

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

When a photo first appears, and as the bounds of the UIScrollView showing a photo change (due to, for example, autorotation), you must adjust the zooming to show as much of the photo as possible with no extra, unused space. Once the user starts pinching to zoom on a given photo, you can stop doing this automatic zooming while that photo continues to be visible.

Like described in lecture #9 viewDidLayoutSubviews is for such occasions the proper place. First calculate which scale would be needed to either show the complete width, or the complete height of the photo. Then pick the higher one because the smaller one would show unused space:

- (void)viewDidLayoutSubviews
{
    [super viewDidLayoutSubviews];
    double wScale = self.scrollView.bounds.size.width / self.imageView.image.size.width;
    double hScale = self.scrollView.bounds.size.height / self.imageView.image.size.height;
    if (wScale > hScale) self.scrollView.zoomScale = wScale;
    else self.scrollView.zoomScale = hScale;
}

The complete code is available on github.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #4 Task #5

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

When the user then chooses a particular photo from the list, display it inside a UIScrollView that allows the user to pan and zoom.

Like in the previous task, you can safe some time be reusing code from Shutterbug.

In storyboard drag out a new view controller. Create a new subclass for it and link them. Add a scroll view and provide an outlet for it in the new class:

@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;

Create a push segue from the cell of the second table to the new view controller and set its identifier to “Show Image”:
Continue reading “cs193p – Assignment #4 Task #5”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – 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 one of the tags in the list, navigate to a new list of the titles of all the photos (in the data you queried originally with stanfordPhotos) that have that tag. The subtitles in this list should be the photo’s description (if it has one).

This task is similar to the previous one (and you could safe some time by reusing the code from shutterbug).

Create a new table-view-controller sub class. As model use an array to hold the photos – note, this time it has to be public, as the other view controller needs to set it.

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

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

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #4 Task #3 & #7

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

The main (non-Recents) tab must present a list containing all of the tags (FLICKR_TAGS) on all of the photos queried except the tags “cs193pspot,” “portrait” & “landscape” (note that Flickr tags come back all lower case with no special characters). The subtitle for each cell in this list should display how many photos have the corresponding tag. Capitalize the tags so they look a bit nicer in the list.

All lists should each be displayed in a UITableView.

Create a new UITableViewController sub class. The model of the controller needs two properties. An array to store the photos received from Flickr and a dictionary where those photos are sorted by its tags:

@property (nonatomic, strong) NSArray *photos; // of NSDictionary
@property (nonatomic, strong) NSDictionary *photosByTag; // of NSArray of NSDictionary

Continue reading “cs193p – Assignment #4 Task #3 & #7”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #4 Task #2

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

Your user-interface should present a UITabBarController-based UI with two tabs, each of which contains its own navigation (i.e. UINavigationController-based) stack. One tab lets you browse (in the manner described below) all of the photos returned in the above query and another which maintains a list of the photos the user has most recently viewed in your application.

In storyboard (currently we stay with the iPhone and ignore the iPad) use the “embed-in” functionality to add a navigation view controller. Copy both view controllers. Use the “embed-in” functionality to add a tab view controller. Connect the tab view controller also to the second navigation view controller. Name and set icons accordingly:

cs193p - assignment #4 task #2
cs193p – assignment #4 task #2

The complete code is available on github.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail