Last Lecture objective C memory management rules Wrote our first iPhone app a quiz app xib and nib files and interface editor MVC pattern IBOutlet IBAction Connection Inspector then wrote init, showQuestion, and showAnswer
Core Location Framework whereami application classes that enable finding geographical position distanceFilter and desiredAccuracy properties
Delegation locationManager:didUpdateToLocation:f romLocation: sent to “delegate” which we want WhereamiAppDelegate to be
Delegation the design pattern... an OO approach to callbacks allows callback methods to share data a delegate can only be sent messages specified in its protocol for every object that can have a delegate, there is a corresponding protocol
some funcs removed
like “interfaces” in other langs... i.e. no impl protocols for delegations “delegate protocols” can be used to ask things from the delegate or inform of updates can methods... by default required... here all were optional
every object implements respondsToSelector: something like this (above) class has to declare protocols it implements like other langs no warning anymore
memory and delegation delegates are usually controllers delegates never retained retain cycle assign attrib... weak reference
lets display a map of current location
whereami object diagram
Several instances of MKAnnotationView appear as icons on the MKMapView. An MKMapView displays the map and the labels for the recorded locations. A UIActivityIndicatorView indicates that the device is working and not stalled. A UITextField allows the user to input text to label the current location on the map.
#import drag the map view onto UIWindow
all we do is set showsUserLocation property of MKmapview and it will show user’s location
too big the dot on world map want to zoom in when to send a zoom in message instead MKMapView has delegate
lets add an annotation MKAnnotation protocol lets create a new MapPoint class
in xib file set text field’s delegate to be the instance of WhereamiAppDelegate. this means we can implement methods from UITextFieldDelegate
Touch touch events are hallmark of mobile devices lets make a drawing app like brushes
touch events
events added to event queue A UITouch object created and tracked for a finger set of UITouches passed... one per finger only the moving, begining, or ending event passed lets make our app
use IB to set the view to default
Blocks in ios 4.0 change colors based on angle and length
blocks = anonymous methods
colors when you shake
blocks capture variables like anonymous functions in c# inline block objects (values copied) blocks are an alternate to callbacks blocks are used for GCD... kind of like tasks
grand central dispatch dispatch queues pools of threads managed by
threads
calling back on UI thread
lets download an image asynchronously
generate 10k random numbers if needed read 10K random numbrs, sort n display UITableView
dispatch_after dispatches after a delay timers dependencies group of tasks
Where did we start from Where to go from here
started with handling multiple input sources in C++, discovered message loop refactored, understood events, event processing, source, target, event object downloaded VS and c# language and its features examples of OO programming in c#
delegates, events, exception handling, attributes, collections worked with XML docs wpf history and xaml property elements and markup extensions mixing xaml and procedural code
logical and visual trees dependency properties change notifications prop val. inheritance attached properties sizing, positioning, and transforming elements
transforms panels stackpanel, wrappanel, canvas, dockpanel, grid content overflow, clipping, scaling, scrolling events, input events, attached events, touch events (manipulation... high level) commands, persisting and restoring
resources... binary and logical static vs dynamic logical resources data binding, binding object, binding markup extension binding to collection, implicit datacontext datatemplates and value converters customizing collection view... sorting, filtering, grouping, navigating data providers... xml and object data providers
concurrency and threads captured variables synchronization context and tasks continuations task completion source sync vs async
course grained vs fine grained sync async wait keywords in c# 5.0 parallelism cancellation and progress reporting task combinator and task parallel library Parallel.Invoke, For, ForEach concurrent collections
JS history and jQuery library HTML CSS JS client side vs server side dom jQuery selectors and filters changing attributes and elements events and animations ajax... xmlhttprequest, get put load JSON...
mobile development objective C history call syntax and OO concepts properties retain count and memory management xib, nib, iboutlet, ibaction, interface builder
button events and a QA app protocols and delegates location and map kits touch events and blocks GCD and multithreading