cs193p – Lecture #6 – Views and Gestures

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

Lecture #6 starts with a short demonstration on how to use abstract view controller classes and their sub classes.

The theory part of the lecture introduces how multiple MVCs work together to be specific navigation controllers and segues, which is shown in another demonstration.

The lecture closes with an explanation of tab-bar controllers.

The code for this lecture is available at github for attributor and for matchismo as well as from Stanford.

The lecture as well as its slides are available via iTunes called “6. Views and Gestures”.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Lecture #5 – View Controller Lifecycle

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

Lecture #5 starts with an introduction to text views and – new to iOS 7 – text storages and TextKit followed by a short demo.

The view-controller life cycle consists of the following steps:

  • the view gets instantiated e.g. from storyboard
  • awakeFromNib is called, which you could compare to init
  • the outlets get set
  • viewDidLoad is called, which can be used for basic setups
  • geometry is determined
  • viewWillLayoutSubviews and viewDidLayoutSubviews are called
  • viewWillAppear and viewDidAppear are called
  • viewWillLayoutSubviews and viewDidLayoutSubviews are called
  • viewWillDisappear and viewDidDisappear are called
  • didReceiveMemoryWarning is called when memory gets low

Continue reading “cs193p – Lecture #5 – View Controller Lifecycle”

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.

Change the image on the back of the cards (i.e. something other than a Stanford logo). Also, set the application and launch image icons for Matchismo. Try to get the resolutions right for each application icon and launch image. Let your creativity run wild when it comes to designing an icon!

Using your favorite graphic program, create two new images for the front and the back of the card, and export each of them in two formats 40×60 and 80×120. Visit your image assets and drag in the new images:

cs193p – assignment #2 extra task #2 - card front
cs193p – assignment #2 extra task #2 – card front
cs193p – assignment #2 extra task #2 - card back
cs193p – assignment #2 extra task #2 – card back


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.

Add a UISlider to your UI which travels through the history of the results of the currently-being-played game’s card choices and display it to the user (moving the slider will modify the contents of the text label you created for Required Task 5 to show its state over the course of the game). When you are displaying past results, you probably want the text label to be grayed out or some such (take a look at the UIView method alpha and note that UISlider inherits from UIView) so it’s clear that it’s “the past.” And every time a new choice happens, you probably want to “jump to the present” in the slider. Implementing this extra credit item will require you to familiarize yourself with UISlider’s API and to add a data structure to your Controller to keep track of the history. It can be implemented in fewer than a dozen lines of code.

The history of previous card flips has nothing to do with the model, thus we a will add this feature in the view control. First create an array property to hold the history and use lazy instantiation:

@property (strong, nonatomic) NSMutableArray *flipHistory;
...
- (NSMutableArray *)flipHistory
{
    if (!_flipHistory) {
        _flipHistory = [NSMutableArray array];
    }
    return _flipHistory;
}

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

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.

Do not change the method signature of any public method we went over in lecture. It is fine to change private method signatures (though you should not need to) or to add public and/or private methods.

… done

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.

Change the UI of your game to have 30 cards instead of 12. See Hints about the size of cards.

Change the size of the cards – instead of using the “hint” you can also use the size inspector to set the size directly. Adjust the positions of the cards and add new lines of cards using copy and paste. Don’t forget to wire all new cards to the card-buttons array of the view controller:

cs193p – assignment #2 task #6 - 30 cards
cs193p – assignment #2 task #6 – 30 cards

The complete code is available on github.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #2 Task #5

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

Add a text label somewhere which desribes the results of the last consideration by the CardMatchingGame of a card choice by the user. Examples: “Matched J♥ J♠ for 4 points.” or “6♦ J♣ don’t match! 2 point penalty!” or “8♦” if only one card is chosen or even blank if no cards are chosen. Do not violate MVC by building UI in your Model. “UI” is anything you are going to present to the user. This must work properly in either mode of Required Task 3.

Lets muse a little bit about what to put where … How the actual text look like, e.g. you could use another language, or other wording, or even if you want to separated the card descriptions by spaces or commas, has nothing to do with the game but with the presentation and should be part of the view. However after you have matched cards, the view itself does not know which cards have been selected last, and cannot even derive that information from the model. It also does not know anything about a penalty or bonus. This information needs to be provided by the model.
Continue reading “cs193p – Assignment #2 Task #5”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail