My Blog List

Showing posts with label apps. Show all posts
Showing posts with label apps. Show all posts

Tuesday, May 31, 2011

Study Notes: Design Patterns: MVC (Part 3) Windows and Views (Part 4)


Study Notes 3: Design Patterns: MVC

P 141

·     The Model View Controller(MVC) is one of the basic design patterns around which frameworks are designed.
·     A design pattern is a commonly used template
·     MVC pattern is populated with 3 kinds of objects
o   Model Objects
§     Engine of the app, app’s data and logic
§     Like a particular t.v. program, independent of set brand and home wiring/cable/delivery method
o   View Objects
§     Displays things on the screen
§     Responds to user actions
§     Anything I see in an app is a kind of view object
§     Like a television screen, independent of program, just displays and responds to my touches on controls by sending info off to whomever it ought to go to
o   Controller Objects
§     Connects apps view objects TO it’s model objects
§     Like the circuitry that pulls the show off cable and sends it to the screen or requests a pay-per-view show

My examples:
M       A dairy
V       A home order form for milk that I fill out
C       The milk woman who looks at my order, puts the milk into her truck and delivers it to my home

M       My home furnace
V       My thermostat
C      
* Ductwork for my furnace that sends heat in
* also whatever mechanism the thermostat triggers that sends a message to the furnace to heat up some air and pump it into the ductwork

Study Notes 4: Windows and Views

·     Single window on iPad an instance of the UIWindow class, created by UIKit
·     A window is a specialized kind of window
·     I add views to the window
·     I don’t directly close or manipulate an iPad window
·     A view is an area on top of the window
·     View is main way that app interacts with users
o   Display content
o   Handle touch events
·     View Hierarchy
o   Content view(s) added as subview(s)
o   A view with a subview is a superview
o   One view 0 to N subviews, 1 superview
o   Subviews displayed on top of their superviews/parents
o   Controls: buttons, text fields, etc are (become) subviews
o   Drawing and Event Handling lowest level subview first rendered. Each subview returns control to its superview after it is rendered
o   UIKit framework handles the view hierarchy relationships
      
·     Kinds of Views (p 148) (are all of these views container views?
o   Container Views
o   Display Views
o   Text and Web views
o   Alert views and action sheets
o   Navigation views
o   (The window) Root container for all other views

Monday, May 30, 2011

Study Terms: Interface Builder

Am currently working with the Neil Goldstein/Tony Bove book iPad Application Development for Dummies, Version 2. Some ideas to reinforce from today's reading.

(page 101)


* The View Controller Window is the table of contents for the nib file. It represents an instance of each object. Also it always contains two proxy objects.

Proxy Objects

What is a proxy object? I know that a proxy is a substitute for an object and that an objective-C class can be accessed through a proxy object. They are something I give directions to to assume control for me. I think that proxy objects create things on the fly as opposed to my hard-coding them. I'd like to increase my understanding of proxy objects, because I think it would help me to better understand some of the ways that the SDK works.

      * File's Owner
             * is the controller object
             * is responsible for contents of the nib file
             * (in this example) is the View Controller

      * First Responder
              * first entry in the apps dynamically constructed responder chain
              * is the object, with which, the user is currently interacting

(Regular) Objects (in book example p 101)

       * View
              an instance of the UIView class






Friday, October 8, 2010

Reviewing Concepts: Keeping our Time Travel Customers from getting Stranded

 Please CLICK ON THE PICTURE to enjoy the details 
of this Time Travel Portal 
and you probably thought it was just the Millbrae BART station


Sometimes I just skim through my review adding all kinds of useful features to my Time Traveler app. Other days, I have to start over a square 0.

I never did figure out what was hanging up my code. I just had to go back to the most basic working model and recreate it one element at at time.

There's days when it's just like that.

 .......
Version:1.0 StartHTML:0000000193 EndHTML:0000045221 StartFragment:0000002859 EndFragment:0000045185 SourceURL:file://localhost/Users/Laurel/Apps%20Learning/Journal%20Portal%20Counter.doc
  GDB was configured as "x86_64-apple-darwin".tty /dev/ttys001
Loading program into debugger…
Program loaded.
run
[Switching to process 3410]
Running…
We at PORTAL PILOTS, know that NOBODY wants to get trapped Before the Common Era!

                  We care about your safety.

Todays entrance count for this portal,  is 5

Debugger stopped.
Program exited with status value:0.

//  REbuilding TimeTravelSecurit Counter from a working model up
//   to find why it just hangs
//  classVariables.m page 109
//   used final choice in NewProject

//
// Time Travel Security Counter (bugs in version 1 I'm not finding)
// TTravSecurityCounter2

// Based on review of ideas page 108 Quick Start Objective C
// Every object in a class shares the same variable
//      AND if one object changes a class variable, that variable is changed for all objects
// I can create a class variable with the 'static' keyword
// 
// In this case, I'm using a class variable to keep track of the number of objects of a particular class my code creates
//     PORTAL PILOTS needs to keep track of the number of time travellers that ENTER their portals
//       to make sure that the proper number of travellers eventually EXIT those portals
//     so this seems like the perfect opportunity to practice using a class variable



// Class

#import <stdio.h>

#import <Foundation/Foundation.h>

@interface ThePortal: NSObject 

static int PortalEntranceCount;
+(int) getCount;

// Remember that when I use '+' for a method it's a 'class method'
//    class methods are methods I can execute using just the class name - no object is required
//       (page 84 of the Quick Start Book)

@end

// Methods

@implementation ThePortal
-(ThePortal*) init
// Here 'self' returns a pointer to the current object
//   on page 97 the book does this same thing
//  using a constructor to initialze the data in an object when you create an object

// Don't do what I did and confuse this with the OTHER class method (getCount)
// which we can execute using just the class name no object

{
    self = [super init];
    PortalEntranceCount++;
    return self;
   
}

+(int) getCount
{
    return PortalEntranceCount;
}

@end


int main(void)
{
    ThePortal *tc1 =[ThePortal new];

    ThePortal *tc2 =[ThePortal new];
    ThePortal *tc3 =[ThePortal new];
    ThePortal *tc4 =[ThePortal new];
    ThePortal *tc5 =[ThePortal new];

   
    printf("We at PORTAL PILOTS, know that NOBODY wants to get trapped Before the Common Era!\n \n");
    printf("\t \t We care about your safety. \n \n");
    //printf("\r \r We care about your safety. \n \n");
    //printf("\f \f We care about your safety. \n \n");

    printf("Todays entrance count for this portal,  is %i\n",[
                                                    ThePortal getCount]);
   
    return 0;
}