My Blog List

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

No comments:

Post a Comment