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

cs193p – Assignment #4 Task #1

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

You will be using the method stanfordPhotos in the provided FlickrFetcher helper code to get an NSArray of Flickr photos of various sites on the Stanford campus. Each entry in the NSArray is an NSDictionary object with numerous entries which describe the photo (more on this below). FlickrFetcher.h has #defines for the keys.

Create a new single-view project. Because the we know already that it should also run on iPads in the near future (extra task #2 or next assignment) make it universal. Add the Flickr-API to the project by dragging in the provided files (or get them from Shutterbug). Get the API key directly from Flickr and set it in FlickrAPIKey.h.

For now – we will not use it later on – add some test code to the automatically generated view controller to see if the interface to Flickr works.

#import "FlickrFetcher.h"
...
- (void)viewDidLoad
{
    [super viewDidLoad];
    NSLog(@"%@", [FlickrFetcher stanfordPhotos]);
}

The complete code is available on github.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Lecture #9 – Scroll View and Table View

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

Lecture #9 starts with an update concerning the view-controller lifecycle. Where pre-Autolayout you would have used viewWillAppear: for geometry based initialization, you should now use viewDidLayoutSubviews: because the first is called only when a view appears on screen and the later each time the bounds of of self.view change.

This is followed by a thorough introduction to scroll and table views. The second half of the lecture demonstrates both by populating a table view with information of photos from Flickr and to display them in a scroll view.

The code of the demo is available at Stanford and on github.

Slides are available on iTunes …..

The lecture is available at iTunes and is named “9. Scroll View and Table View (February 5, 2013)”.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #3 Extra Task #6

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

Make this a two player game. There’s no need to go overboard here. Think of a simple UI and a straightforward implementation that make sense.

Create a new property to hold the separate scores of the players and another one to know the current player:

@property (strong, nonatomic) NSMutableArray *playerScores; // of NSNumber
@property (nonatomic) int currentPlayer;
...
- (NSMutableArray *)playerScores
{
    if (!_playerScores) {
        _playerScores = [NSMutableArray arrayWithObjects:@0, @0, nil];
    }
    return _playerScores;
}

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

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail