Sunday 27 April 2014

Post WDI - iPhone App Sandbox, Data Management Persistence Mechanisms (Object Archiving, Core Data to SQLite)

iPhone Development (Xcode 5) (Cont'd)

iPhone App Sandbox and Data Management  DONE
  • Application Sandbox { restrictions (policy and technical) introduced by Apple to protect users from malicious apps harming their devices, and where all apps exist in a sandbox. violation cause for app rejection from App Store }
  • Object Archiving 
    • Object Graph { all references between interlinked web of objects in memory. used for Cocoa's Object Archiving (serialisation mechanism) where the object graph is stored to the file system and unarchived and read it back into memory to restore a session at the same point. Object Archiving Components include NSCoder object and NSCoding Protocol }
      • NSCoder { encode and decode archiving any object to NSCoding Protocol using "keyed encoding" where a key is provided for each instance var }
      • NSCoding Protocol 
      • Methods: 
        • initWithCoder { Decoding where key is provided and decoded instance var returned } 
        • encodeWithCoder { Encode all instance vars (using encodeObject:forKey, encodeInt:forKey, encodeBool:forKey, encodeDouble:forKey, encodeBytes:forKey) of object to store during archival. implemented with decision on instance vars of scalar type to encode or not encode (transient) } 
    • Archiving to File
      • archiveRootObject:toFile of NSKeyedArchiver (on applicationWillTerminate event)
    • Unarchiving from File
      • unarchiveObjectWithFile method from NSKeyedUnarchiver(on viewDidLoad event)
    • Data Storage Options
      • Library/Preferences Directory { access indirectly with NSUserDefaults API }
      • Library/Caches Directory { direct file manipulation, cache retrieved data, persists between launches, improves performance }
      • Documents Directory { direct file manipulation, main location to store, backed up when synced }
      • tmp Directory { direct file manipulation outside devices limited volatile memory without persisting between launches of app }
    • File Paths 
      • NSSearchPathForDirectoriesInDomains { Core Foundation function returns multiple directories in NSArray with NSStrings extracted with objectAtIndex }
      • stringByAppendingPathComponent { joins path fragments }
    • Interface Elements
      • Flexible Space Bar Button
  • Core Data 
    • Dfn: Object-Relational Mapping (ORM) framework (handles conversion of data to and from objects in the app and relational data in a database) providing management and persistence of in-memory object graphs comprising multi-level undo management, data validation, data consistency across independent data accessors, efficient filtering with indexing, sorting, and searching object graphs, and persistence between invocations to various data repositories 
    • Uses: wraps the SQLite database and relational database (alternative to using SQL and SQLite API directly) to perform querying and data management functions of CRUD (create, read, update, delete)
    • Alternatives to SQLite Repository 
      • Uses: Core Data features (undo support, object schema versioning) without need for relational databases
      • Binary File Format { same limits on large data sets as Object Archiving }
      • In-Memory Implementation { no persistence between app invocations }
    • Concepts of Core Data
      • Managed Object Context { subset of persistent objects used by app at a point in time and containing the object graph. Core Data notices changes to the objects and persists changes to the database when save is called }
      • Managed Object { object managed by Core Data that can be added or removed from object graph resulting in Core Data performing inserts and deletes w database. changes to attributes and relationships of managed objects results in Core Data performing update operations to database }
      • Managed Object Model { object-relational schema, description of Entities persisted via Core Data. it's a mapping between an object in Objective-C and an Entity as it will be stored as rows in a database table in SQLite }
        • Xcode Data Modelling Tool { for .xcdatamodel files }
      • Entity 
        • Dfn: model of managed object containing only parts of object that Core Data will be persisting
        • Model Types:
          • Object Attributes { for persisting }
          • Relationships and Other Entities { stored to form a persistent object graph }
      • Persistent Stack { parts of Core Data that interact with a data repository like SQLite }
    • Core Data Application Template 
      • Dfn: boilerplate code that contains additional properties and actions to allow the Core Data application to interact with the managed object context through its application delegate 
      • Features:
        • @dynamic construct { tells compiler missing property getters and setters in implementation file will be provided by superclass NSManagedObject at runtime } 
        • managedObjectContext property { Core Data managed object context for passing to controllers subview in the app window upon applicationDidFinishLaunching }
      • CRUD (Create, Read, Update, Delete)
        • insertNewObjectForEntityForName:inManagedObjectContext method of NSEntityDescription { Create. arguments include name of Entity NSString from managed object model, and reference to managed object context }
        • NSFetchRequest instance in viewDidLoad method { Fetch. with NSEntityDescription to specify type of Entity to fetch, returns NSMutableArray of managed objects
        • hasChanges used by managed object context to report any changes to managed objects that were tracked and save in the applicationWillTerminate method 
        • deleteObject method of NSManagedObjectContext is passed managed object to delete
        • Note: NSUInteger vs NSNumber (scalar integer vs actual object)
Curiosity:



Links:

Post WDI - iPhone Storing App Preferences

iPhone Development (Xcode 5) (Cont'd)

iPhone Storing App Preferences   DONE
  • Application Preferences (aka Settings, User Defaults, User Preferences, Options)
    • Overall preference system where apps customise for users
  • Application Preferences System { low-level tasks of persisting preferences to iPhone with app preferences separate and backed up  
  • Design Principles
    • Opinionated Software { limit app preferences with an opinion on best ways to accomplish tasks serves larger market } 
    • Implicit (In-App) Preference Exposure { based on user actions using the app and returning to last state of app upon reuse }
    • Explicit Preference Exposure using Apples Settings Application { single location to customise iPhone Settings Bundle, but UI is limited }
    • Alternatively { customized toolbar with limited frequently used items and a 'more' button }
    • Examples { API access, streamline w default inputs saved to reduce user taps }
  • Utility App Template { contain info icon that animates a transition to a flipside view for setting app preferences when tapped }
  • Settings Bundle Template { generated from Resources group in sidebar it creates a Root.plist file editable in Property List Editor, which controls appearance of the app in the settings bundle where preferences may be set and retrieved from the preferences database and grouped. types may be edited (i.e. PSTextFieldSpecifier changed to PSMultiValueSpecifier). note that multiple PList files may be created (i.e. About, etc) }
  • Reading and Writing User Defaults
    • NSUserDefaults API { singleton pattern (only one instance object of class stored) class used to store app preferences as key/value pairs }
    • viewWillDissappear event { persist in saving key values when view disappears  (i.e. on/off state and levels as constants) using setBool and setFloat methods of standardUserDefaults method  associated with NSUserDefault singleton API. preferences stored in PList file (XML property list file) }
    • viewDidLoad event { read and use preferences when view appears upon application launch using floatForKey and boolForKey methods of NSUserDefaults API. set the preferences with a Helper Method setValuesFromPreferences, and cover the initial case with default settings using a dictionary of default preference keys and values to the registerDefaults method. Array Title String properties and Array of UITextFields setup by reading preferences current value from NSUserDefaults, and used for storage and editing. Store preferences into user defaults database using Utility Template App 'done' action instance }
  • In-App Preferences
    • FlipSideViewController (to implement table view Delegate and Data Source Protocols instead of using TableViewController) for Utility Template App (with Flipside View) 
      • Preferences Stored and Edited { added as subviews of table cells content view }
Links:

Post WDI - iPhone Multiview Navigation-Based Apps (Table View Categories)

iPhone Development (Xcode 5) (Cont'd)

iPhone Multiview Navigation-Based Apps (with Table Views)    DONE
  • Table Views { toolset to display list of cells onscreen by Category and Sub Category, they respond to touch events and allowing users to scroll up and down, with each single cell structured to contain multiple pieces of info, and cells broken into sections of info clusters }
    • Types
      • Plain (aka Index Tables) { lack visual separation of sections of grouped tables
      • Grouped 
    • Implementation
      • UITableView { instance creates table view }
        • Methods:
        • accessoryType ("disclosure indicator" array. touching reveals details)
      • UITableViewController { subclass instance handles interactions with table view and conforms to req'd protocols }
      • UITableViewDataSource Protocol { provide data for table to display } 
        • Methods: 
        • numberOfSectionsInTableView (qty table sections)
        • tableView:tableViewNumberOfRowsInSection (qty rows in each section)
      • UITableViewDelegate Protocol { creating cells in table and react to user selection }
        • Methods:
        • tableView:titleForHeaderInSection (string title section no.)
        • tableView:cellForRowAtIndexPath (returns UITableViewCell object for table section and row)
        • tableView:didSelectRowAtIndexPath { react to row touch event from user using indexPath instance }
      • NSIndexPath { communicates row and section info (IndexPath for incoming objects in table methods with accessors IndexPath.section and IndexPath.row }
        • Methods:
        • UILabel object { textLabel, setText }
    • Memory Management
      • Reuse cells no longer req'd to generate current display instance of allocation across all table cells
  • Navigation Controller { allow user to drill down multiple views of data }
  • Navigation Controller Stack { new views appear when view controllers are instantiated and pushed onto the navigation controller stack or to go back the navigation controller pops the current view off the stack to unload it and previous view moves to top of stack and becomes active }
  • Apple Navigation-Base Application Template
    • Preparation
      • UINavigationController { instance of Root View Controller and subclass of UITableViewController. It is a navigation controller that provides functionality to push and pop other controllers }
        • Properties: { title property }
      • UINavigationBar { horizontal navigation bar with UI elements to navigate views }
      • UINavigationItem { used to display title in navigation bar }
Links:

Friday 25 April 2014

Post WDI - iPhone Multiview App Architecture (Multiple-View Controllers, Toolbars)

iPhone Development (Xcode 5) (Cont'd)

iPhone Multiview Apps (with Toolbar) (manually created)   DONE
  • UIViewController { load and swap multiple @class subviews (separate controller structure) with UIView instance method insertSubView:atIndex. use default controller to clear current view (i.e. clearView ), remove inactive subviews  where superview property is tested to be nil using removeFromSuperView for individual or simultaneous views }
  • UIToolbar and UIBarButtonItem { overlayed floating subview index to switch views based on event action (i.e. Touch Up Inside) }


iPhone Multiview Apps (with Tab Bar) (expedited method)   DONE
  • UITabBar and UITabBarController (not the Apple default tab bar)
    • UITabBarControllerDelegate Protocol has all optional methods 
    • appplicationDidFinishLaunching method to add tabBarViewController instance
    • floatValue of NSString class provides floating point numbers from user input returning 0.0 for incorrect input allowing valid calculation always
    • viewWillAppear method used as hook to only update view just before displayed onscreen when we have access to all objects

Events Upcoming
    • ATTENDED - MyBirthdayApp, 28th Apr 2014
    • ATTENDED - Sydney MongoDB Meetup, 6pm, 29 Apr 2014 (MongoDB Australia, 2-12 Foveaux St Surry Hills)
    • ATTENDED - Entrepreneurs of 2025 - (Start Presenting To Groups) - 6:30pm 30 Apr 2014 (Level 1 99 York St) - Organiser and Host (Cyril Sansano) Beware: Nobody turned up except for me despite 11ppl RSVP'ing!!!
    • ATTENDED  - GA Launch Party - 6-9pm, Fri 2 May 2014 GA Sydney (York St), 56-58 York St

Post WDI - iPhone Interface Notifications, Alerts, AudioToolbox Framework (Modals, Action Sheets, Sounds, Vibrations)


iPhone Development (Xcode 5)
 (Cont'd)

iPhone / Cocoa Touch Interface Notifications and Alerts (   DONE
  • UIAlertView { modal alert window of message and options including 'delegate' actions upon dialog dismissal (i.e. low memory, dropped network, activity completion) }
    • Multi-Option Alerts 
      • otherButtonTitles for multiple buttons
      • UIAlertViewDelegate Protocol conformance (declared in header and 'delegate' pointer to object instantiating alert for effects after dismissal) and either alertView:clickedButtonAtIndex method for index of button pressed or buttonTitleAtIndex method to return its title (where not nil)
      • Constants { for defining button labels }
  • UIActionSheet { prompt decision from user based on actions (i.e. share, upload, bookmark, data modifications) }
    • Animated Opening from current View Controller UI Element { i.e. [actionSheet showInView:self.view]; } or Toolbar { showFromToolBar } or TabBar { showFromTabBar }
    • Custom Appearance { actionSheetStyle property (i.e. actionSheet.actionSheetStyle=UIBarStyleBlackTranslucent), or UIActionSheetStyleAutomatic (inherit any set view style), or UIActionSheetStyleBlackOpaque (shiny black) }
    • UIActionSheetDelegate Protocol conformance (declared in header and 'delegate' pointer to object instantiating action sheet for effects after dismissal) and either actionSheet:clickedButtonAtIndex method to capture index of button press event or buttonTitleAtIndex method to return its title (where not nil)
    • Dynamic Buttons { addButtonWithTitle method to add outside the 'initialization convenience method', in combination with cancelButtonIndex and destructiveButtonIndex }
  • System Sound Services API
    • Uses: potentially uninterruptive Sound, Alert, Vibrate notifications as user feedback, attention, error, action status
    • AudioToolbox Framework { add using menus and then import interface file with #import <AudioToolbox/AudioToolbox.h> }
    • Vibrations { substitute into stub method block kSystemSoundID_Vibrate }
  • Stub Methods { i.e. -(IBAction)doAction }

Post WDI - iPhone Interface Control Design Techniques


iPhone Development (Xcode 5) (Cont'd)
  • iPhone Techniques to Customise Interface Controls (   DONE
    • viewDidLoad method in Implementation File
      • Automatically invokes after instantiation of view from XIB File so is convenient hook to make changes to the view as it is being displayed
    • UIImaged Class 
      • 'imageNamed' method contains filename string
      • 'stretchableImageWithLeftCapWidth:topCapHeight' instance method with image property defining its stretchability (if zero cannot stretch, any other value is column of pixels ignored before stretching occurs)
    • Hiding Keyboard
      • resignFirstResponder Approach
// declare action using stub method for method hideKeyboard-(IBAction) hideKeyboard:(id)sender { [x resignFirstResponder];}// connect IB fields from .xib file to hideKeyboard using Connections Inspector and 'Did End on Exit event'
    • Touch Background Approach
      • Create invisible button behind and attach hideKeyboard method 
    • Dynamic Content { Embedded Placeholders <___> inside objects }
      • stringByReplacingOccurrencesOfString:WithString instance method { searches template text for placeholders string (i.e. < xyz >) and replaces with user input stored in text view
-(IBAction) createMessage:(id)sender { theMessage.text=[theTemplate.text stringByReplacingOccurrencesOfString:@"<xyz>" withString:theNewMessage.text];}

  • iPhone Techniques to Customise User-Controlled Animations, Image Views, and Sliders (  DONE
    • UISlider 'value' property { Reversing the Scale (faster animation uses small numbers, slower animations use larger numbers), Continuous option (on: generates events as slide, off: generate event at end of user touch) }
    • UIImageView { display static image or Arrays of frame-based animations  }
      • isAnimating, startAnimating, stopAnimating methods
    • ViewDidLoad method of ViewController { additional setup option for view }
    • initWithFormat method { floating-point value (f) formatted to string with one digit to left of decimal point and two digits to right of it (i.e. 1.2f)

  • Advanced iPhone Interface Controls ( DONE
    • Objective-C Automatic Reference Counting (ARC) 
      • Disabled in App 'Build Settings' > All > CLANG_ENABLE_OBJC_ARC
    • Switch Toggle { UISwitch }
      • Methods { isOn }
    • Segment Controls { UISegmentedControl }
      • Methods { titleForSegmentAtIndex }
      • Properties { selectedSegmentIndex }
    • Web Views { UIView }
      • Supports HTML, CSS, Javascript, etc (i.e. for self-contained websites within app)
      • Remote Content Loading { NSURL, NSURLRequest, requestWithURL, alternatively [<web view> loadHTMLString:<html_content> baseURL:nil] }
      • initFileURLWithPath:isDirectory method {load files from resources }
      • goForward, goBack { navigation }
      • Properties { hidden } for Hiding and Showing 
    • Scrolling Views { UIScrollView }
    • Pickers 
      • Dfn: contains components (i.e. arrays columns) with rows of values. Use Protocols to return multiple values from multiple selections in single interface
      • UIPickerView (Custom Type) { Class created conforming to Protocols UIPickerViewDelegate and UIPickerViewDataSource is req'd (not just Attributes Inspector) }
      • UIDatePicker { returns NSDate object using 'date' method, instance method timeIntervalSinceDate for Data Structure calcs with NSTimeInterval class, NSDateFormatter object to format label display, setDateFormat (custom date format from string) stringFromData (returns string in format defined) }
    • Protocols
      • Dfn: Collection of methods to perform task selected depending on desired features, where classes conform in implementing the protocol
      • Types:
        • UIPickerViewDataSource (Protocol) { methods of qty data displayed and returns qty rows of values displayed in component respectively }  (i.e. numberOfComponentsInPickerView, pickerView:numberofRowsInComponent)
        • UIPickerViewDelegate (Protocol) { methods to pass filtered data text to component row display and returns user row of choice (objectAtIndex for NSArray) and last touched component (selectedRowInComponent method) respectively } (i.e. pickerView:titleForRow:forComponent, pickerView:didSelectRow:inComponent)
      • Conformance to Protocols 
        • Declare Protocols conforming to in view controller .h file (this automatically creates Outlets connection points for Picker to be Connect to manually)
        • Configure Picker manually by Connecting to 'Data Source' and 'Delegate' Protocol Outlets in IB
@interface PickerViewController : UIViewController <UIPickerViewDataSource, UIPickerViewDelegate>
      • Constants { apply before #import }
#define componentName 0
      • Picker Custom Images 
        • UIImageView instance populated with array of images from resources
        • pickerView:titleForRow:forComponent:reusingView {display images in picker}
[[UIImageView alloc] initWithImage:[UIImage imgName:<img name>]];
        •  Subclasses of UIView for all other picker contents to display image views in picker
      • Picker Customer Dimensions { CGFloat, pickerView:rowHeightForComponent, pickerView:widthForComponent }
      • Memory { autorelease method when need to return variables for use }

Links:




Post WDI - iPhone MVC App Design Approach Fundamentals

iPhone Development (Xcode 5) (Cont'd)


  • MVC App Design Approach with iPhone {  DONE
    • Definition: Model-View-Controller (Controller bridges components, Model supplies Data, View obtains and reacts to user input)
    • Benefits: Reusable Object-Oriented Programs, Multiple Developer Teams (i.e. Git) ('Separation of Concerns' between functional units), Maintainable & Extendability of App
    • Typical App Req'ments: User Interface, Handle & React to User Input, Store Info to React Correctly
    • Views (handle the UI)
      • Connection Points (Outlets, Actions) required for objects in View to interact with app logic. Define Outlets and Actions in Controller (where code implements logic of Views)
        • Outlets Code-to-View path to read/write values
        • Actions Method triggered by event in View
    • View Controllers (implement functional logic)
      • Use:
        • Define Outlets for Connection Points (IBOutlet Directive in .h)
        • Define Actions for Connection Points (IBAction Directive in .h)
        • Handles interactions with View
        • Note: IBOutlet and IBAction recognised as markers by IB
    • Example with @property and @synthesise
// declare instance 'myLabel'
@property (retain, nonatomic) NSString *myLabel; 
// simplify accessing properties defined in header file using @synthesize in the implementation file to create getters/setters conveniently. 
@synthesize myLabel; 
// get/set current value from UILabel 'text'
propertycurrentLabel = myLabel.text // getter
myLabel.text = @"My New Label" // setter (noting that UILabel and UITextField have a property called 'text')
  • Example of instance method declaration using adaptable 'id' generic data type
// declare instance method used as action.
// accepts 'id' special generic data type object as parameter
// for variable that causes input param availability
-(IBAction)doCalculation:(id)sender;
  • Data Models
    • In-Controller Data Models
    • Standalone Separate Data Models (Core Data modelling tool from iPhone SDK to visually lay out interfaces and map a data structure)
  • View-Base Application Template Practice (without Core Data modelling tools)
    • Classes
      • Example (__AppDelegate.m)
// define instance method. action is adding view to window and make it visible
// accepts UIApplication (object class that handles events) variable as parameter
// 'application' makes input parameter available
-(void)applicationDidFinishLaunching:(UIApplication *)application { 
// override point for customization after app launch
  [window addSubview:viewController.view];
  [window makeKeyAndVisible];
}
    • ViewController Files __ViewController.h and __ViewController.m
      • Implements the view controller class (UIViewController) containing logic to control a view
    • PList File
      • Use: Configure so XIB File loaded when app starts (i.e. MainWindow.xib), which instantiates the ViewController class, whose View is loaded from its associated XIB file
    • Example (Create View Controller Code Outlets and Actions as IB Connection Points)
// declare view controller outlets directives and actions in view controller header file to enable IB to visually connect view label object to userOutput instance variable. *userOutput accesses instance variable in view controller
// declare outputs within @interface block 
IBOutlet UILabel *userOutput;
IBOutlet UITextField *userInput;


// define variables as properties for easy access (after the @interface block) 
@property (retain, nonatomic) UITextField *userInput;
@property (retain, nonatomic) UILabel *userOutput;
// simplify accessing properties defined in header file using @synthesize in the implementation file to create getters/setters conveniently. alternative to the following @synthesize code is less readable and maintainable [userOutput setText: [userInput getText]];
@synthesize userOutput;
@synthesize userInput;   
// declare instance method in the implementation file of the view controller used as an action (explained in previous example)
// get the value of UILabel's property called 'text' for variable 'userInput'
// set it to the value of UILabel's property called 'text' for variable 'userOutput'
-(IBAction)setOutput:(id)sender {  userOutput.text=userInput.text;}
  • Designing User Interface (UI) View with Interface Builder (IB)
  • Connecting the View to the View Controller Outlets and Actions with IB
    • Connection Inspector (instead of drag-drop) for connecting event objects (i.e. Buttons)
  • Memory Release
// use 'release' method in the dealloc method of view controller[userInput release];[userOutput release];[super dealloc];

Wednesday 23 April 2014

Post WDI - iPhone, Cocoa Touch & Interface Builder Fundamentals

Activities @ Reading Book (Sams Teach Yourself iPhone App Dev in 24 hrs (IMO 1-2 weeks full-time to learn properly) (by Ray & Johnson)

iPhone Development (Xcode 5) (
  • Test & Build DONE
    • Snapshots, Pragma marks, Project Properties {icon, status}, Build Outputs, iPhone Simulator, Simulate Conditions {finger pulls OPT} ) 


    • Interface File ( DONE
      • Protocols {< > collection of common grouped methods}
      • IBOutlet {object defined in interface builder},
      • Directives {i.e. @interface}, 
      • Defining Method Getters and Setters
        • Class Methods { +(<type_returned>)<method_name>:(..).. ..:(..)..; },
        • Instance Methods { -(..; }, Multiple Params
        • Directive { @property (.., <attributes>) <object> *<instance_var>; }, 
        • Synthesise { simplify interaction by defining properties of instance var objects and generating code for their getters/setters (accessors/mutators) }  


      • Implementation File DONE
        • Comments { // or /* }, 
        • Primitive Data Types {int, float, double},
        • Objects {data types, pointers, instance var, methods}, 
        • Declare Variable Object {declare instance var pointing to mem loc'n of object of specific class i.e. NSString *userName }, 
        • Allocate Memory for Object {alloc message to the class}, Initialize {init message to initialize mem contents allocated to object of specific class}, x = [[UILabel alloc] init]; {x is now a usable but not useful object}, 
        • Convenience Method {special config steps to setup object and basic properties for use (i.e. label name, screen location, etc)} --> x = [[UILabel alloc] initWithString:@"abc"]; { creates new string object of type NSString and sets its property pointer},  
        • Messaging Syntax {send object a msg by giving name of var/class referencing the object and method name, then params, gives boolean result} --> [<obj var/class> <method_name>:@"<param_val>" <param2>:<param2_val / manner_to_perform_method>]; }, 
        • Predefined Values {nil lack of value}, 
        • Nested Messaging {benefit of using results directly instead declare temp var to hold} --> i.e. z = [[x capitalizedString] stringByAppendString:[y capitalizedString]]; (where: object var 'y', instance method 'capitalizedString', method name 'stringByAppendString', param value result of 'y capitalizedString'), 
        • Expressions {use values returned from methods of objects and their properties to create expressions} --> i.e. [x compare:@"y"] (result is boolean), 
        • Expression Syntax { (), ==, !=, &&, ||, ! }, 
        • If-Then-Else, Switch Statement, Loops - Condition-Based Loops {For Loop with initialize counter, test condition, increment}, Condition-Based Loop {While, Do While}, Autoincrementing {and De-...},
        • Memory Management (differs fron OS X which has automatic garbage collection), Releasing Objects is Dev's Responsibility (except vars holding less mem intensive Primitive Data Types i.e. @"" syntax) { calling 'release' method i.e. [<var> release]; }, Auto Releasing Objects { i.e. [<var> autorelease]; --> inefficient release from object pool }, Retaining Objects { i.e. when object created as returned from a method (not directly created) i.e. [<var> retain]; }, Retain & Release Count { retain message increases count, release decreases, object remove from memory when count reaches zero }, Releasing Instance Methods { use 'dealloc' method and 'release' call on instance method (i.e. 'x') to parent class  i.e. -(void)dealloc { [x release]; [super dealloc]; } 


        • Cocoa Touch {  DONE
          • Dfn; collection of frameworks customised for touch/handheld interface to build iPhone platform apps and runtime to execute user interface based on Cocoa framework
          • iPhone OS Service Layers each containing diff frameworks { Cocoa Touch (UI (i.e. events, phone, data, camera, photo, accelerom) / Map / Game Kits (i.e. p2p networks, sessions, voicechat) + Msg / AddrBk UI's), Media (Audio (i.e. play, record, vibrations) / OpenGL / MediaPlyer / Core Grphx (i.e. 2d drawing) / Quartz Core (i.e. Core Animations)), Core Services (Foundation (i.e. manipulate strings, arrays, dict. + app threads prefs, internat.), Core Fndtn (i.e. procedural C -> non-OO), Core Loc'n (i.e. GPS lat/long + precision), Core Data (i.e. data modelling SQL), Store Kit (i.e. in-app App Store transactions), Sys Config (i.e. network config status)), Core OS (CFN Network (i.e. BSD sockets, HTTP, FTP, Bonjour, etc), Ext Accessory (i.e. docked/bluetooth), Security (i.e. encrypt, decrypt, iPhone keychain interact), System Framework (i.e. subset of Unix dev tools)) }
          • iPhone App Lifecycle Trace {launch setup with application delegate class creating View (Output) and View Controller (Input Events), input event loop handling from Cocoa Touch interface and manipulating views, termination}
          • Core App Classes
            • Autocreated
              • Root Class (NSObject) { most classes inherit }
              • Applic Object (UIApplication) { handle events, notifications, app config }
              • Window Objects (UIWindow) { superview containers of instance views }
              • Manual Created
                • Views (UIView) { subview nested rect area instance of UIWindow create with Interface Builder (IB) }
                • Responders (UIResponder) { touch events passed up "Chain of Responders" under reach "First Responder" able to actively handle }
                • Onscreen Controls (UIControl) { inherits from UIView as superclass of onscreen controls touch event handling and triggering. events tied to controls with IB }
                • View Controllers (UIViewController) { manage content of views. instances of view controller implement actions to react }
              • Data Type Classes
                • Strings (NSString, NSMutableString)
                • Arrays (NSArray, NSMutableArray) { collection data type, i.e. initWithObjects, objectAtIndex }
                • Dictionaries (NSDictionary, NSMutableDictionary) { collection data type with key/value(object), i.e. objectForKey (access) }
                • Numbers (NSNumber, NSDecimalNumber) { i.e. numberWithInt }
                • Dates (NSDate) { i.e. userDate, earlierDate }
                • URLs (NSURL) { 'host' method to parse and grab just the machine name from the string }
                • Interface Classes
                  • Labels (UILabel)
                  • Buttons (UIButton)
                  • Switches (UISwitch) { on/off states }
                  • Segmented Control (UISegmentedControl) { bar }
                  • Sliders (UISlider)
                  • Text Fields (UITextField/UITextView)
                    • Scrolling behaviour (not Rich text)
                  • Pickers (UIDatePicker/UIPicker)


                • Interface Builder (IB) { DONE
                  • Dfn: Standalone graphical app dependent on Xcode and iPhone Simulator
                  • Use: Visual Approach to Responsive User Interface (UI) Design. Live objects are built that link to app code through connections that may be triggered
                  • XIB (XML) File Output from IB holds interface & non-interface objects that we add visually to the project and are automatically instantiated and accessible when file loaded. XIB file contents:
                    • File's Owner { object that loads XIB. instantiates other XIB objects }
                    • First Responder { object that user currently in control and interacting }
                    • View { instance of UIView visual layout displayed on iPhone. views are hierarchical and contain 'clustered controls' for views within views }
                  • Document Icons 
                    • Note: XIB File generated by ticking checkbox "With XIB for user interface" when generating new Class file
                    • Linking GUI Icons with Code: Open the XIB File, drag an icon to the interface, press CTRL and drag icon on top of the File's Owner Icon
                  • IB Objects Library (CMD+SHIFT+L)
                    • Use: Palette of objects to drag and drop into views with help of Guides
                    • Custom Guides > Layout Add Horiz/Vert Guide
                  • Size Inspector
                    • Frame Values exact area object on-screen
                    • Layout Values allow space around object
                  • Attributes (Object Properties) Inspector
                    • Label text editing
                    • View inherited attributes from 'View superclass to on-screen elements
                    • Clear Button (X)
                    • Placeholders
                    • Keyboard Text Input Traits {Capitalize, Spelling Auto-Correction, Keyboard Type, Appearance (alert view), Return Key (Done, Search, Next, Go), Auto-Enable Return Key (user input req'd before show), Security }
                    • Scrolling Bounce and Color
                    • Data Detectors { automatically detects phone numbers, urls, etc..  and convert to helpful links }
                    • Styled Buttons { Shape, Detail Disclosure (addit info), Info Light/Dark Color, Add Contact (+), Custom (custom button images) }
                    • State Configuration Menu { changing state interacts with user touches on/off }
                  • Outlets
                    • Variables that IB objects references that access/change their contents
                  • Actions
                    • Methods called when events occur (object event trigger code actions)
                      • Connections Inspector { connect event to code action by drag a circle (event to support object) to File's Owner icon }
                  • Connections
                    • Joining IB elements to outlets or actions
                  • Default Connections { i.e. 'web view'  (goForward, goBack), drag button Touch Up Inside event direct to 'web view' instead of File's Owner }
                  • Identity (Object) Inspector
                    • Accessibility Attributes
                      • Voiceover {speech synthesis on touch onscreen elements}
                    • Accessibility Inspector (Simulator overlay)
                      • Enable within iPhone Simulator [Hardware Menu > Home], click Nav circle (left-side), [Settings > General > Accessibility > Accessibility] Inspector
                    • Building Custom Instances of Classes { instances created when drag objects to interface. manually set identity of objects in IB }