Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 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

2 Core Location Framework whereami application classes that enable finding geographical position distanceFilter and desiredAccuracy properties

3

4 Delegation locationManager:didUpdateToLocation:f romLocation: sent to “delegate” which we want WhereamiAppDelegate to be

5

6 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

7 some funcs removed

8 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 be @optional methods... by default required... here all were optional

9 every object implements respondsToSelector: something like this (above) class has to declare protocols it implements like other langs no warning anymore

10 memory and delegation delegates are usually controllers delegates never retained retain cycle assign attrib... weak reference

11 lets display a map of current location

12 whereami object diagram

13 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.

14 #import drag the map view onto UIWindow

15

16 all we do is set showsUserLocation property of MKmapview and it will show user’s location

17 too big the dot on world map want to zoom in when to send a zoom in message instead MKMapView has delegate

18 lets add an annotation MKAnnotation protocol lets create a new MapPoint class

19

20

21 in xib file set text field’s delegate to be the instance of WhereamiAppDelegate. this means we can implement methods from UITextFieldDelegate

22

23

24

25 Touch touch events are hallmark of mobile devices lets make a drawing app like brushes

26 touch events

27 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

28

29 use IB to set the view to default

30

31

32

33

34 Blocks in ios 4.0 change colors based on angle and length

35

36

37 blocks = anonymous methods

38

39 colors when you shake

40 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

41 grand central dispatch dispatch queues pools of threads managed by

42 threads

43 calling back on UI thread

44

45 lets download an image asynchronously

46

47 generate 10k random numbers if needed read 10K random numbrs, sort n display UITableView

48

49

50 dispatch_after dispatches after a delay timers dependencies group of tasks

51 Where did we start from Where to go from here

52 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#

53 delegates, events, exception handling, attributes, collections worked with XML docs wpf history and xaml property elements and markup extensions mixing xaml and procedural code

54 logical and visual trees dependency properties change notifications prop val. inheritance attached properties sizing, positioning, and transforming elements

55 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

56 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

57 concurrency and threads captured variables synchronization context and tasks continuations task completion source sync vs async

58 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

59 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...

60 mobile development objective C history call syntax and OO concepts properties retain count and memory management xib, nib, iboutlet, ibaction, interface builder

61 button events and a QA app protocols and delegates location and map kits touch events and blocks GCD and multithreading


Download ppt "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."

Similar presentations


Ads by Google