cs193p – Lecture #7 – Collection View and Protocols

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

Lecture #7 handles protocols, collection views – again – with an extensive demo.

… lots about protocols and its usage …

UICollectionsViews are new in IOS6. They are assemblies of UICollectionViewCells arranged e.g. by UICollectionViewFlowLayout.

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 “7. Collection View and Protocols (January 29, 2013)”.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #2 Extra Task #3

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

Add another tab for some “settings” in the game.

We will need to access the settings from both card games as well as from the settings view. Therefore we create a new class derived from NSObject with public properties of the “settings” which can be used by all of those controllers:

@interface GameSettings : NSObject
@property (nonatomic) int matchBonus;
@property (nonatomic) int mismatchPenalty;
@property (nonatomic) int flipCost;
@end

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

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #2 Extra Task #2

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

Add third tab to track the user’s scores. It should be clear which scores were playing card match games and which scores were Set card match games.

The tab has already been implemented during lecture #5.

To be able to separate the scores of the different games, it is necessary to another property which can provide this information:

@property (strong, nonatomic) NSString *gameType;

Continue reading “cs193p – Assignment #2 Extra Task #2”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #2 Extra Task #1

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

Create appropriate icons for your two tabs. The icons are 30×30 and are pure alpha channels (i.e. they are a “cutout” through which the blue gradient shines through). Search the documentation for more on how to create icons like that and set them.

Create the icons in your favorite graphic program, save them to your project and set them in storyboard:

cs193p - assignment #2 extra task #1
cs193p – assignment #2 extra task #1

The complete code is available on github.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #2 Task #8

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

Your Set game should also report (mis)matches like Required Task #3 in Assignment 1, but you’ll have to enhance this feature (to use NSAttributedString) to make it work for displaying Set card matches.

In storyboard copy the label from the card-game view to the set-game view and connect it to the set-game view controller. Change it from “plain” to “attributed”.

In updateUI create a new attributed string which derives from the last-flip description. Update this string with the card attributes in the for loop and – at the end – use it for the label text:
Continue reading “cs193p – Assignment #2 Task #8”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #2 Task #7

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

Your Set game should have a Deal button, Score label and Flips label just like your playing card matching game from Assignment 1 does.

In story board copy the flip and the score label as well as the deal button from the game card view to the set card view and link them to the appropriate outlets in the set-card view controller.

The complete code is available on github.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #2 Task #6

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

Instead of drawing the cards in the classic form (we’ll do that next week), we’ll use these three characters ▲ ● ■ and use attributes in NSAttributedString to draw them appropriately (i.e. colors and shading).

In story board change the title of the buttons from plain to attributed. Inside the update function generate an attributed strong from the card contents. Check if the current card is a set card and update the attributes using updateAttributedString:withAttributesOfCard:, which we will create next. Finally set the adjusted title off the button:
Continue reading “cs193p – Assignment #2 Task #6”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail