Info

Programmer by day, artist by night

What’s in iOS7: 4 major layers

Starting from the bottom to top:

Core OS

  • OS X Kernel
  • Mach 3.0
  • BSD
  • Sockets
  • Security
  • Power Management
  • Keychain Access
  • Certificates
  • File System
  • Bonjour

Core Services

  • Collections
  • Address Book
  • Networking
  • File Access
  • SQLite
  • Core Location
  • Net Services
  • Threading
  • Preferences
  • URL Utilities
Media

  • Core Audio
  • Open AL
  • Audio Mixing
  • Audio Recording
  • Video Playback
  • JPEG, PNG, TIFF
  • PDF
  • Quartz (2D)
  • Core Animation
  • OpenGL ES

Cocoa Touch

  • Multi-Touch
  • Core Motion
  • View Hierarchy
  • Localization
  • Controls
  • Alerts
  • Web View
  • Map Kit
  • Image Picker
  • Camera

Platform Components:

  1. Tools: Xcode 5, Instruments
  2. Language: Objective-C
  3. Frameworks: Foundation, UIKit, Core Data, Map Kit, Core Motion
  4. Design Strategies: MVC

Controller-View Communication Types

  • Outlets: Target-Action
  • Delegates: will, should, did type of methods
  • Data source delegates: data at, count

Controller-Model Communication Types

  • Notification and KVO

Card Object

contents
chosen
matched
-(int)match:

Experimenting with the Card class

Since the Card class was created in this lecture, here are some experiments with the Card class in main.m.
10 cards created starting with 0, 1, 2 … 9. A single random card is generated with content range from 0 to 19.

Output 1 (with a match):
2013-11-02 04:33:46.900 Cards[40876:303] New card content: 3
2013-11-02 04:33:46.902 Cards[40876:303] We found a match. Score: 1

Output 2 (with no match):
2013-11-02 04:34:26.295 Cards[40882:303] New card content: 18
2013-11-02 04:34:26.296 Cards[40882:303] Sorry, no match found.

#import
#import "Card.h"

int main(int argc, const char * argv[])
{
    @autoreleasepool {

        NSMutableArray *cards = [[NSMutableArray alloc] init];
        // insert code here...
        for (int i = 0; i < 10; i++) {
            Card *card = [[Card alloc] init];
            card.contents = [NSString stringWithFormat:@"%d", i];
            [cards addObject:card];
        }

        Card *newCard = [[Card alloc] init];
        int randomNumber = arc4random() % (cards.count + 10);
        newCard.contents = [NSString stringWithFormat:@"%d", randomNumber];

        NSLog(@"New card content: %@", newCard.contents);

        int score = [newCard match:cards];
        if (score) {
            NSLog(@"We found a match. Score: %d", score);
        } else {
            NSLog(@"Sorry, no match found.");
        }
    }
    return 0;
}

Comments

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Basic HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS