SlideShare uma empresa Scribd logo
1 de 63
Baixar para ler offline
Tools to create Apps in iPhone

Interface Builder

Xcode

Mac
Instruments
Simulator/device
Total 67 Pages

2
Sound and Music Computing


We use iPhone to make music!
 Mobile Music Group
◦ MOGFUN
◦ MOGCLASS
◦ MOGHEALTH

Total 67 Pages

3
MOGCLASS


MOGCLASS DEMO

Total 67 Pages

4
MOGCLASS


Do you want to create your own iPhone
App or develop novel user interface for
MOGCLASS?

Total 67 Pages

5
You need to know…


Language: Objective-C and C/C++
 Objective Oriented Programming
 Programming and testing in Xcode
 Digital Signal Processing basics
 Assembly Code (ARM)
 Computer Network
 Etc…

Total 67 Pages

6
Today we will cover…


Objective-C basics
 Building an Application
 Sensor programming (accelerometer, GPS,
microphone…)
 Audio Libraries


There are a lot of materials about iphone
online. What we will cover today is more
oriented for your final project.
Total 67 Pages

7
How to learn iPhone Programming


Recommended Book: None! We’ll use
Apple documentation
 iOS Developer Center:
◦ Download the sample code and learn.

http://developer.apple.com/devcenter/ios/index.action



Write the code by yourself… Trial and
error.

Total 67 Pages

8
iPhone SDK Technology
Architecture
Cocoa
Touch

•
•
•
•
•

Multi-Touch Events
Multi-Touch Controls
Accelerometer
View Hierarchy
Localization

Alerts
Web View
People Picker
Image Picker
Camera

Media

•
•
•
•
•

Core Audio
OpenAL
Audio Mixing
Audio Recording
Video Playback

JPG, PNG,TIFF
PDF
Quartz (2D)
Core Animation
OpenGL ES

Core
Services

•
•
•
•
•

Collections
Address Book
Networking
File Access
SQLite

Core Location
Net Services
Threading
Preference
URL utilities

Core OS

•
•
•
•
•

OS X Kernel
Mach 3.0
BSD
Sockets
Security

Power Mgmt
Keychain
Certificates
File System
Bonjour
Total 67 Pages

9
Outlines


Objective-C basics
 Building an Application
 Sensor programming (accelerometer, GPS,
microphone…)
 Audio Libraries

Total 67 Pages

10
OOP Vocabulary


Class: defines the grouping of data and
code, the ―type‖ of an object.
 Instance: a specific allocation of a class.
 Method: a ―function‖ that an object knows
how to perform.
 Instance Variable (or ―ivar‖): a specific
piece of data belonging to an object.

Total 67 Pages

11
OOP Vocabulary


Encapsulation



Polymorphism



Inheritance

◦ Keep implementing private and separate from
interface
◦ Different objects, same interface
◦ Hierarchical organization, share code,
customize or extend behaviors

Total 67 Pages

12
Objective-C








Strict superset of C

◦ Mix C with ObjC
◦ Or even C++ with ObjC (usually referred to as
ObjC++)

A very simple language, but some new
syntax
Single inheritance, classes inherit from one
and only one superclass
Protocols define behavior that cross classes
Dynamic runtime
Loosely typed, if you’d like
Total 67 Pages

13
Class and Instance Methods


Instance respond to instance methods
-(id)init;
-(float)height;
-(void)walk;

• Classes respond to class methods
+(id)alloc;
+(id)person;
+(Person*)sharedPerson;

Total 67 Pages

14
Message Syntax
[receiver message];
[receiver message:argument];
[receiver message:arg1 andArg: arg2]

Total 67 Pages

15
Terminology






Message expression
[receiver method:argument]

Message
[receiver method:argument]

Selector
[receiver method:argument]

Method
The code selected by a message.

Total 67 Pages

16
Dot Syntax


Objective-C 2.0 introduced dot syntax
 Convenient shorthand for invoking accessor
methods
float height = [person height];
float height = person.height;
[person setHeight: newHeight];
person.height = newHeight;

 Follows

the dots…

[[person child] setHeight:newHeight];
//exact the same as
person.child.height = newHeight;
Total 67 Pages

17
Dynamic and static typing


Dynamically-typed object
id anObject




 just id
 Not id * (unless you really, really mean it…)

Statically-typed object
Person *anObject

Objective-C provides compile-time, not
runtime, type checking
 Objective-C always uses dynamic binding
Total 67 Pages

18
Selectors identify methods by name



A selector has type SEL
SEL action = [button action];
[button setAction: @selector(start:)];

Conceptually similar to function pointer
 Selectors include the name and all colons,
for example:
-(void) setName:(NSString*)name age:(int)age;

would have a selector:
SEL sel = @selector(setName:age:);

Total 67 Pages

19
Working with selectors




You can determine if an object responds to a
given selector
id obj;
SEL sel = @selector(start:)
if ([obj respondsToSelector:sel]){
[obj performSelector: sel withObject:self];
}

This sort of introspection and dynamic
messaging underlies many Cocoa design
patterns
-(void)setTarget:(id)target;
-(void)setAction:(SEL)action;
Total 67 Pages

20
Working with Classes


You can ask an object about its class
Class myClass = [myObject class];



NSLog(@"My class is %@", [myObject className]);

Testing for general class membership (subclasses
included):
if ([myObject isKindOfClass:[UIControl class]]) {
// something



}

Testing for specific class membership (subclasses
excluded):
if ([myObject isMemberOfClass:[NSString class]]) {
// something string specific
}
Total 67 Pages

21
Working with Objects


Identity v.s. Equality
 Identity—testing equality of the pointer
values


if (object1 == object2) {
NSLog(@"Same exact object instance");
}

Equality—testing object attributes
if ([object1 isEqual: object2]) {
NSLog(@"Logically equivalent, but may
be different object instances");
}

Total 67 Pages

22
-description



NSObject implements -description
- (NSString *)description;

Objects represented in format strings using %@
 When an object appears in a format string, it is
asked for its description



[NSString stringWithFormat: @”The answer is: %@”,
myObject];

You can log an object’s description with:
NSLog([anObject description]);

Your custom subclasses can override description
to return more specific information
Total 67 Pages

23
Foundation Framework


Foundation Classes
◦ NSObject
 String

 NSString / NSMutableString

 Collection





NSArray / NSMutableArray
NSDictionary / NSMutableDictionary
NSSet / NSMutableSet
NSNumber

 Others

 NSData / NSMutableData
 NSDate / NSCalendarDate
Total 67 Pages

24
More OOP Info


Tons of books and articles on OOP
 Objective-C 2.0 Programming Language

Total 67 Pages

25
Outlines


Objective-C basics
 Building an Application
 Sensor programming (accelerometer, GPS,
microphone…)
 Audio Libraries

Total 67 Pages

26
Anatomy of an Application


Compiled code



Nib files




◦ Your code
◦ Frameworks

◦ UI elements and other objects
◦ Details about object relations

Resources (images, sounds, strings, etc)
Info.plist file (application configuration)
Total 67 Pages

27
App Lifecycle

Total 67 Pages

28
App Lifecycle


Main function
 UIApplicationMain which Info.plist to
figure out what nib to load.
 MainWindow.xib contains the
connections for our application.
 AppDelegate
 ViewController.xib
 View – handle UI events
Total 67 Pages

29
Model-View-Controller

Total 67 Pages

30
Communication and MVC

Total 67 Pages

31
Model


Manages the app data and state
 Note concerned with UI or presentation
 Often persists somewhere
 Same model should be reusable,
unchanged in different interfaces

Total 67 Pages

32
View


Present the Model to the user in an
appropriate interface
 Allows user to manipulate data
 Does not store any data


◦ (except to cache state)

Easily reusable & configurable to display
different data

Total 67 Pages

33
Controller


Intermediary between Model & View
 Updates the view when the model
changes
 Updates the model when the user
manipulates the view
 Typically where the app logic lives

Total 67 Pages

34
Outlines


Objective-C basics
 Building an Application
 Sensor programming (accelerometer, GPS,
microphone, …)
 Audio Libraries

Total 67 Pages

35
Accelerometer



What are the accelerometers?
◦ Measure changes in force

What are the uses?
 Physical Orientation vs. Interface
Orientation
◦ Ex: Photos & Safari

Total 67 Pages

36
Orientation-Related Changes



Getting the physical orientation
◦ UIDevice class

 UIDeviceOrientationDidChangeNotification

Getting the interface orientation
◦ UIApplication class

 statusBarOrientation property

◦ UIViewController class

 interfaceOrientation property

Total 67 Pages

37
Shake
Undo!


UIEvent type

◦ @property(readonly) UIEventType type;
◦ @property(readonly) UIEventSubtype
subtype;
◦ UIEventTypeMotion
◦ UIEventSubtypeMotionShake

Total 67 Pages

38
Getting raw Accelerometer Data


3-axis data
 Configurable update frequency (10-100Hz)
 Sample Code (AccelerometerGraph)


Class



Protocol

◦ UIAccelerometer
◦ UIAcceleration
◦ UIAccelerometerDelegate
Total 67 Pages

39
Getting raw Accelerometer Data
-(void)initAccelerometer{
[[UIAccelerometer sharedAccelerometer] setUpdateInterval: (1.0 / 100)];
[[UIAccelerometer sharedAccelerometer] setDelegate: self];
}
-(void)accelerometer: (UIAccelerometer*)accelerometer didAccelerate:
(UIAcceleration*) acceleration {
double x, y, z;
x = acceleration.x;
y = acceleration.y;
z = acceleration.z;
//process the data…
}
-(void)disconnectAccelerometer{
[[UIAccelerometer sharedAccelerometer] setDelegate: nil];
}
Total 67 Pages

40
Filtering Accelerometer Data


Low-pass filter



High-pass filter

◦ Isolates constant acceleration
◦ Used to find the device orientation
◦ Shows instantaneous movement only
◦ Used to identify user-initiated movement

Total 67 Pages

41
Filtering Accelerometer Data

Total 67 Pages

42
Filtering Accelerometer Data

Total 67 Pages

43
Applying Filters


Simple low-pass filter example

#define FILTERFACTOR 0.1
Value = (newAcceleration * FILTERFACTOR) + (previousValue *
(1.0 – FILTERFACTOR));
previousValue = value;



Simple high-pass filter example

lowpassValue = (newAcceleration * FILTERFACTOR) +
(previousValue * (1.0 – FILTERFACTOR));
previousLowPassValue = lowPassValue;
highPassValue = newAcceleration – lowPassValue;

Total 67 Pages

44
GPS



Classes



Protocol

◦ CLLocationManager
◦ CLLocation
◦ CLLocationManagerDelegate
Total 67 Pages

45
Getting a Location


Starting the location service

-(void)initLocationManager{
CLLocationManager* locManager = [[CLLocationManager alloc] init];
locManager.delegate = self;
[locManager startUpdatingLocation];
}



Using the event data

-(void)locationManager: (CLLocationManager*)manager didUpdateToLocation:
(CLLocation*)newLocation fromLocation: (CLLocation*)oldLocation{
NSTimerInterval howRecent = [newLocation.timestamp timeIntervalSinceNow];
if(howRecent < -10) return;
if(newLocation.horizontalAccuracy > 100) return;
//Use the coordinate data.
double lat = newLocation.coordinate.latitude;
double lon = newLocation.coordinate.longitude;
}
Total 67 Pages

46
Getting a Heading


Geographic North



Magnetic North

◦ CLLocationDirection trueHeading
◦ CLLocationDirection magneticHeading

-(void)locationManager: (CLLocationManager *)manager
didUpdateHeading:(CLHeading*)newHeading{
//Use the coordinate data.
CLLocationDirection heading = newHeading.trueHeading;
CLLocationDirection magnetic = newHeading.magneticHeading;
}

Total 67 Pages

47
Microphone


We will cover it in the audio library…

Total 67 Pages

48
Outlines


Objective-C basics
 Building an Application
 Sensor programming (accelerometer, GPS,
microphone…)
 Audio Libraries

Total 67 Pages

49
Audio Libraries


System Sound API – short sounds
 AVAudioPlayer – ObjC, simple API
 Audio Session - Audio Toolbox
 Audio Queue - Audio Toolbox
 Audio Units
 OpenAL
 MediaPlayer Framework

Total 67 Pages

50
AVAudioPlayer







Play longer sounds (> 5 seconds)
Locally stored files or in-memory (no network
streaming)
Can loop, seek, play, pause
Provides metering
Play multiple sounds simultaneously
Cocoa-style API



Supports many more formats



Sample Code: avTouch

◦ Initialize with file URL or data
◦ Allows for delegate

◦ Everything the AudioFile API supports

Total 67 Pages

51
AVAudioPlayer


Create from file URL or data

AVAudioPlayer *player;
NSString *path = [[NSBundle mainBundle] pathForResource:… ofType:…];
NSURL *url = [NSURL fileURLWithPath:path];
player = [[AVAudioPlayer allow] initWithContentsOfURL:url];
[player prepareToPlay];



Simple methods for starting/stopping

If(!player.playing){
[player play];
}else{
[player pause];
}

Total 67 Pages

52
Audio Sessions




Handles audio behavior at the application,
inter-application, and device levels
◦
◦
◦
◦

Ring/Silent switch?
iPod audio continue?
Headset plug / unplug?
Phone call coming?

Sample Code: avTouch & aurioTouch

Total 67 Pages

53
Audio Sessions


Six audio session categories
◦
◦
◦
◦
◦
◦

Ambient
Solo Ambient (Default session)
Media playback
Recording
Play and record
Offline audio processing

Total 67 Pages

54
Audio Queue






Audio File Stream Services & Audio Queue
Services
Supports wider variety of formats
Finer grained control over playback
◦ Streaming audio over network
◦ Cf: AVAudioPlayer(local)

Allows queueing of consecutive buffers for
seamless playback
◦ Callback functions for reusing buffers

Sample code: SpeakHere
Total 67 Pages

55
Audio Units


For serious audio processing
 Graph-based audio
◦
◦
◦
◦

Rate or format conversion
Real time input/output for recording & playback
Mixing multiple streams
VoIP (Voice over Internet Protocol).



Very, very powerful.



Sample code: aurioTouch
Total 67 Pages

56
Audio Units




Lowest programming layer in iOS audio
stack
◦ Real-time playback of synthesized sounds
◦ Low-latency I/O
◦ Specific audio unit features

Otherwise, look first at the Media Player,
AV Foundation, OpenAL, or Audio
Toolbox!

Total 67 Pages

57
Audio Units


Ex: Karaoke app in iPhone
◦ real-time input from mic
◦ Real-time output to speaker
◦ Audio Unit provides excellent responsiveness
◦ Audio Unit controls audio flow to do pitch
tracking, voice enhancement, iPod
equalization, and etc.

Total 67 Pages

58
OpenAL


High level, cross-platform API for 3D audio mixing



Models audio in 3D space



Sample code: oalTouch



More information: http://www.openal.org/

◦ Great for games
◦ Mimics OpenGL conventions

◦ Buffers: Container for Audio
◦ Sources: 3D point emitting Audio
◦ Listener: Position where Sources are heard

Total 67 Pages

59
MediaPlayer Framework


Tell iPod app to play music
 Access to entire music library
◦ For playback, not processing



Easy access through
MPMediaPickerController
 Deeper access through Query APIs


Sample code: AddMusic
Total 67 Pages

60
Others


Accelerate Framework



Bonjour and NSStream



◦ C APIs for vector and matrix math, digital
signal processing large number handling, and
image processing
◦ vDSP programming guide

The Synthesis ToolKit in C++ (STK) and
OSC
Total 67 Pages

61
More Info for Beginners


iPhone Application Programming
(Standford University - iTunes University)
 Dan Pilone & Tracey Pilone. Head First
iPhone Development.

Total 67 Pages

62


Thank you and good luck to your final
projects!

Total 67 Pages

63

Mais conteúdo relacionado

Destaque

Xcode4 userguide Apple
Xcode4 userguide AppleXcode4 userguide Apple
Xcode4 userguide ApplePragati Singh
 
Mobile Human interface giude
Mobile Human interface giudeMobile Human interface giude
Mobile Human interface giudePragati Singh
 
I phone first app ducat
I phone first app ducatI phone first app ducat
I phone first app ducatPragati Singh
 
I phone apps developments interview
I phone apps developments interviewI phone apps developments interview
I phone apps developments interviewPragati Singh
 
Osx workflow guide (1)
Osx workflow guide (1)Osx workflow guide (1)
Osx workflow guide (1)Pragati Singh
 
Xml color code for android
Xml color code for androidXml color code for android
Xml color code for androidPragati Singh
 
iPhone first App Store submission
iPhone  first App Store submissioniPhone  first App Store submission
iPhone first App Store submissionPragati Singh
 
Bryan gordillo informr_metodo burbuja_ejercicio
Bryan gordillo informr_metodo burbuja_ejercicioBryan gordillo informr_metodo burbuja_ejercicio
Bryan gordillo informr_metodo burbuja_ejercicioBryan Gordillo
 
Proyecto prevención y atención de desastres
Proyecto prevención y atención de desastresProyecto prevención y atención de desastres
Proyecto prevención y atención de desastresINSTITUCIONEDUCATIVAPIOXI
 

Destaque (13)

Xcode4 userguide Apple
Xcode4 userguide AppleXcode4 userguide Apple
Xcode4 userguide Apple
 
Mobile Human interface giude
Mobile Human interface giudeMobile Human interface giude
Mobile Human interface giude
 
I phone first app ducat
I phone first app ducatI phone first app ducat
I phone first app ducat
 
Oop obj c
Oop obj cOop obj c
Oop obj c
 
Iphone development
Iphone developmentIphone development
Iphone development
 
I phone apps developments interview
I phone apps developments interviewI phone apps developments interview
I phone apps developments interview
 
Osx workflow guide (1)
Osx workflow guide (1)Osx workflow guide (1)
Osx workflow guide (1)
 
Xml color code for android
Xml color code for androidXml color code for android
Xml color code for android
 
iPhone first App Store submission
iPhone  first App Store submissioniPhone  first App Store submission
iPhone first App Store submission
 
Android Basic- CMC
Android Basic- CMCAndroid Basic- CMC
Android Basic- CMC
 
About new haven bathroom set
About new haven bathroom setAbout new haven bathroom set
About new haven bathroom set
 
Bryan gordillo informr_metodo burbuja_ejercicio
Bryan gordillo informr_metodo burbuja_ejercicioBryan gordillo informr_metodo burbuja_ejercicio
Bryan gordillo informr_metodo burbuja_ejercicio
 
Proyecto prevención y atención de desastres
Proyecto prevención y atención de desastresProyecto prevención y atención de desastres
Proyecto prevención y atención de desastres
 

Semelhante a Iphone lecture imp

iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)Netcetera
 
Intro to iOS Development • Made by Many
Intro to iOS Development • Made by ManyIntro to iOS Development • Made by Many
Intro to iOS Development • Made by Manykenatmxm
 
Code camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una DalyCode camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una DalyUna Daly
 
iOS Development - Offline Class for Jasakomer
iOS Development - Offline Class for JasakomeriOS Development - Offline Class for Jasakomer
iOS Development - Offline Class for JasakomerAndri Yadi
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011YoungSu Son
 
Adopting Swift Generics
Adopting Swift GenericsAdopting Swift Generics
Adopting Swift GenericsMax Sokolov
 
The advantage of developing with TypeScript
The advantage of developing with TypeScript The advantage of developing with TypeScript
The advantage of developing with TypeScript Corley S.r.l.
 
Advanced Swift Generics
Advanced Swift GenericsAdvanced Swift Generics
Advanced Swift GenericsMax Sokolov
 
MvvmCross Introduction
MvvmCross IntroductionMvvmCross Introduction
MvvmCross IntroductionStuart Lodge
 
MvvmCross Seminar
MvvmCross SeminarMvvmCross Seminar
MvvmCross SeminarXamarin
 
iOS development introduction
iOS development introduction iOS development introduction
iOS development introduction paramisoft
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxMalla Reddy University
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...NicheTech Com. Solutions Pvt. Ltd.
 

Semelhante a Iphone lecture imp (20)

iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)
 
Intro to iOS Development • Made by Many
Intro to iOS Development • Made by ManyIntro to iOS Development • Made by Many
Intro to iOS Development • Made by Many
 
Objective-C
Objective-CObjective-C
Objective-C
 
Code camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una DalyCode camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una Daly
 
iOS Development - Offline Class for Jasakomer
iOS Development - Offline Class for JasakomeriOS Development - Offline Class for Jasakomer
iOS Development - Offline Class for Jasakomer
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011
 
iOS Application Development
iOS Application DevelopmentiOS Application Development
iOS Application Development
 
Stmik bandung
Stmik bandungStmik bandung
Stmik bandung
 
Adopting Swift Generics
Adopting Swift GenericsAdopting Swift Generics
Adopting Swift Generics
 
React native
React nativeReact native
React native
 
1204csharp
1204csharp1204csharp
1204csharp
 
The advantage of developing with TypeScript
The advantage of developing with TypeScript The advantage of developing with TypeScript
The advantage of developing with TypeScript
 
AngularConf2015
AngularConf2015AngularConf2015
AngularConf2015
 
Advanced Swift Generics
Advanced Swift GenericsAdvanced Swift Generics
Advanced Swift Generics
 
MvvmCross Introduction
MvvmCross IntroductionMvvmCross Introduction
MvvmCross Introduction
 
MvvmCross Seminar
MvvmCross SeminarMvvmCross Seminar
MvvmCross Seminar
 
Software Engineering
Software EngineeringSoftware Engineering
Software Engineering
 
iOS development introduction
iOS development introduction iOS development introduction
iOS development introduction
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
 

Mais de Pragati Singh

Nessus Scanner: Network Scanning from Beginner to Advanced!
Nessus Scanner: Network Scanning from Beginner to Advanced! Nessus Scanner: Network Scanning from Beginner to Advanced!
Nessus Scanner: Network Scanning from Beginner to Advanced! Pragati Singh
 
Tenable Certified Sales Associate - CS.pdf
Tenable Certified Sales Associate - CS.pdfTenable Certified Sales Associate - CS.pdf
Tenable Certified Sales Associate - CS.pdfPragati Singh
 
Analyzing risk (pmbok® guide sixth edition)
Analyzing risk (pmbok® guide sixth edition)Analyzing risk (pmbok® guide sixth edition)
Analyzing risk (pmbok® guide sixth edition)Pragati Singh
 
Pragati Singh | Sap Badge
Pragati Singh | Sap BadgePragati Singh | Sap Badge
Pragati Singh | Sap BadgePragati Singh
 
Ios record of achievement
Ios  record of achievementIos  record of achievement
Ios record of achievementPragati Singh
 
Ios2 confirmation ofparticipation
Ios2 confirmation ofparticipationIos2 confirmation ofparticipation
Ios2 confirmation ofparticipationPragati Singh
 
Certificate of completion android studio essential training 2016
Certificate of completion android studio essential training 2016Certificate of completion android studio essential training 2016
Certificate of completion android studio essential training 2016Pragati Singh
 
Certificate of completion android development essential training create your ...
Certificate of completion android development essential training create your ...Certificate of completion android development essential training create your ...
Certificate of completion android development essential training create your ...Pragati Singh
 
Certificate of completion android development essential training design a use...
Certificate of completion android development essential training design a use...Certificate of completion android development essential training design a use...
Certificate of completion android development essential training design a use...Pragati Singh
 
Certificate of completion android development essential training support mult...
Certificate of completion android development essential training support mult...Certificate of completion android development essential training support mult...
Certificate of completion android development essential training support mult...Pragati Singh
 
Certificate of completion android development essential training manage navig...
Certificate of completion android development essential training manage navig...Certificate of completion android development essential training manage navig...
Certificate of completion android development essential training manage navig...Pragati Singh
 
Certificate of completion android development essential training local data s...
Certificate of completion android development essential training local data s...Certificate of completion android development essential training local data s...
Certificate of completion android development essential training local data s...Pragati Singh
 
Certificate of completion android development essential training distributing...
Certificate of completion android development essential training distributing...Certificate of completion android development essential training distributing...
Certificate of completion android development essential training distributing...Pragati Singh
 
Certificate of completion android app development communicating with the user
Certificate of completion android app development communicating with the userCertificate of completion android app development communicating with the user
Certificate of completion android app development communicating with the userPragati Singh
 
Certificate of completion building flexible android apps with the fragments api
Certificate of completion building flexible android apps with the fragments apiCertificate of completion building flexible android apps with the fragments api
Certificate of completion building flexible android apps with the fragments apiPragati Singh
 
Certificate of completion android app development design patterns for mobile ...
Certificate of completion android app development design patterns for mobile ...Certificate of completion android app development design patterns for mobile ...
Certificate of completion android app development design patterns for mobile ...Pragati Singh
 
Certificate of completion java design patterns and apis for android
Certificate of completion java design patterns and apis for androidCertificate of completion java design patterns and apis for android
Certificate of completion java design patterns and apis for androidPragati Singh
 
Certificate of completion android development concurrent programming
Certificate of completion android development concurrent programmingCertificate of completion android development concurrent programming
Certificate of completion android development concurrent programmingPragati Singh
 
Certificate of completion android app development data persistence libraries
Certificate of completion android app development data persistence librariesCertificate of completion android app development data persistence libraries
Certificate of completion android app development data persistence librariesPragati Singh
 
Certificate of completion android app development restful web services
Certificate of completion android app development restful web servicesCertificate of completion android app development restful web services
Certificate of completion android app development restful web servicesPragati Singh
 

Mais de Pragati Singh (20)

Nessus Scanner: Network Scanning from Beginner to Advanced!
Nessus Scanner: Network Scanning from Beginner to Advanced! Nessus Scanner: Network Scanning from Beginner to Advanced!
Nessus Scanner: Network Scanning from Beginner to Advanced!
 
Tenable Certified Sales Associate - CS.pdf
Tenable Certified Sales Associate - CS.pdfTenable Certified Sales Associate - CS.pdf
Tenable Certified Sales Associate - CS.pdf
 
Analyzing risk (pmbok® guide sixth edition)
Analyzing risk (pmbok® guide sixth edition)Analyzing risk (pmbok® guide sixth edition)
Analyzing risk (pmbok® guide sixth edition)
 
Pragati Singh | Sap Badge
Pragati Singh | Sap BadgePragati Singh | Sap Badge
Pragati Singh | Sap Badge
 
Ios record of achievement
Ios  record of achievementIos  record of achievement
Ios record of achievement
 
Ios2 confirmation ofparticipation
Ios2 confirmation ofparticipationIos2 confirmation ofparticipation
Ios2 confirmation ofparticipation
 
Certificate of completion android studio essential training 2016
Certificate of completion android studio essential training 2016Certificate of completion android studio essential training 2016
Certificate of completion android studio essential training 2016
 
Certificate of completion android development essential training create your ...
Certificate of completion android development essential training create your ...Certificate of completion android development essential training create your ...
Certificate of completion android development essential training create your ...
 
Certificate of completion android development essential training design a use...
Certificate of completion android development essential training design a use...Certificate of completion android development essential training design a use...
Certificate of completion android development essential training design a use...
 
Certificate of completion android development essential training support mult...
Certificate of completion android development essential training support mult...Certificate of completion android development essential training support mult...
Certificate of completion android development essential training support mult...
 
Certificate of completion android development essential training manage navig...
Certificate of completion android development essential training manage navig...Certificate of completion android development essential training manage navig...
Certificate of completion android development essential training manage navig...
 
Certificate of completion android development essential training local data s...
Certificate of completion android development essential training local data s...Certificate of completion android development essential training local data s...
Certificate of completion android development essential training local data s...
 
Certificate of completion android development essential training distributing...
Certificate of completion android development essential training distributing...Certificate of completion android development essential training distributing...
Certificate of completion android development essential training distributing...
 
Certificate of completion android app development communicating with the user
Certificate of completion android app development communicating with the userCertificate of completion android app development communicating with the user
Certificate of completion android app development communicating with the user
 
Certificate of completion building flexible android apps with the fragments api
Certificate of completion building flexible android apps with the fragments apiCertificate of completion building flexible android apps with the fragments api
Certificate of completion building flexible android apps with the fragments api
 
Certificate of completion android app development design patterns for mobile ...
Certificate of completion android app development design patterns for mobile ...Certificate of completion android app development design patterns for mobile ...
Certificate of completion android app development design patterns for mobile ...
 
Certificate of completion java design patterns and apis for android
Certificate of completion java design patterns and apis for androidCertificate of completion java design patterns and apis for android
Certificate of completion java design patterns and apis for android
 
Certificate of completion android development concurrent programming
Certificate of completion android development concurrent programmingCertificate of completion android development concurrent programming
Certificate of completion android development concurrent programming
 
Certificate of completion android app development data persistence libraries
Certificate of completion android app development data persistence librariesCertificate of completion android app development data persistence libraries
Certificate of completion android app development data persistence libraries
 
Certificate of completion android app development restful web services
Certificate of completion android app development restful web servicesCertificate of completion android app development restful web services
Certificate of completion android app development restful web services
 

Último

GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 

Último (20)

GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 

Iphone lecture imp

  • 1.
  • 2. Tools to create Apps in iPhone Interface Builder Xcode Mac Instruments Simulator/device Total 67 Pages 2
  • 3. Sound and Music Computing  We use iPhone to make music!  Mobile Music Group ◦ MOGFUN ◦ MOGCLASS ◦ MOGHEALTH Total 67 Pages 3
  • 5. MOGCLASS  Do you want to create your own iPhone App or develop novel user interface for MOGCLASS? Total 67 Pages 5
  • 6. You need to know…  Language: Objective-C and C/C++  Objective Oriented Programming  Programming and testing in Xcode  Digital Signal Processing basics  Assembly Code (ARM)  Computer Network  Etc… Total 67 Pages 6
  • 7. Today we will cover…  Objective-C basics  Building an Application  Sensor programming (accelerometer, GPS, microphone…)  Audio Libraries  There are a lot of materials about iphone online. What we will cover today is more oriented for your final project. Total 67 Pages 7
  • 8. How to learn iPhone Programming  Recommended Book: None! We’ll use Apple documentation  iOS Developer Center: ◦ Download the sample code and learn. http://developer.apple.com/devcenter/ios/index.action  Write the code by yourself… Trial and error. Total 67 Pages 8
  • 9. iPhone SDK Technology Architecture Cocoa Touch • • • • • Multi-Touch Events Multi-Touch Controls Accelerometer View Hierarchy Localization Alerts Web View People Picker Image Picker Camera Media • • • • • Core Audio OpenAL Audio Mixing Audio Recording Video Playback JPG, PNG,TIFF PDF Quartz (2D) Core Animation OpenGL ES Core Services • • • • • Collections Address Book Networking File Access SQLite Core Location Net Services Threading Preference URL utilities Core OS • • • • • OS X Kernel Mach 3.0 BSD Sockets Security Power Mgmt Keychain Certificates File System Bonjour Total 67 Pages 9
  • 10. Outlines  Objective-C basics  Building an Application  Sensor programming (accelerometer, GPS, microphone…)  Audio Libraries Total 67 Pages 10
  • 11. OOP Vocabulary  Class: defines the grouping of data and code, the ―type‖ of an object.  Instance: a specific allocation of a class.  Method: a ―function‖ that an object knows how to perform.  Instance Variable (or ―ivar‖): a specific piece of data belonging to an object. Total 67 Pages 11
  • 12. OOP Vocabulary  Encapsulation  Polymorphism  Inheritance ◦ Keep implementing private and separate from interface ◦ Different objects, same interface ◦ Hierarchical organization, share code, customize or extend behaviors Total 67 Pages 12
  • 13. Objective-C       Strict superset of C ◦ Mix C with ObjC ◦ Or even C++ with ObjC (usually referred to as ObjC++) A very simple language, but some new syntax Single inheritance, classes inherit from one and only one superclass Protocols define behavior that cross classes Dynamic runtime Loosely typed, if you’d like Total 67 Pages 13
  • 14. Class and Instance Methods  Instance respond to instance methods -(id)init; -(float)height; -(void)walk; • Classes respond to class methods +(id)alloc; +(id)person; +(Person*)sharedPerson; Total 67 Pages 14
  • 15. Message Syntax [receiver message]; [receiver message:argument]; [receiver message:arg1 andArg: arg2] Total 67 Pages 15
  • 16. Terminology     Message expression [receiver method:argument] Message [receiver method:argument] Selector [receiver method:argument] Method The code selected by a message. Total 67 Pages 16
  • 17. Dot Syntax  Objective-C 2.0 introduced dot syntax  Convenient shorthand for invoking accessor methods float height = [person height]; float height = person.height; [person setHeight: newHeight]; person.height = newHeight;  Follows the dots… [[person child] setHeight:newHeight]; //exact the same as person.child.height = newHeight; Total 67 Pages 17
  • 18. Dynamic and static typing  Dynamically-typed object id anObject    just id  Not id * (unless you really, really mean it…) Statically-typed object Person *anObject Objective-C provides compile-time, not runtime, type checking  Objective-C always uses dynamic binding Total 67 Pages 18
  • 19. Selectors identify methods by name   A selector has type SEL SEL action = [button action]; [button setAction: @selector(start:)]; Conceptually similar to function pointer  Selectors include the name and all colons, for example: -(void) setName:(NSString*)name age:(int)age; would have a selector: SEL sel = @selector(setName:age:); Total 67 Pages 19
  • 20. Working with selectors   You can determine if an object responds to a given selector id obj; SEL sel = @selector(start:) if ([obj respondsToSelector:sel]){ [obj performSelector: sel withObject:self]; } This sort of introspection and dynamic messaging underlies many Cocoa design patterns -(void)setTarget:(id)target; -(void)setAction:(SEL)action; Total 67 Pages 20
  • 21. Working with Classes  You can ask an object about its class Class myClass = [myObject class];  NSLog(@"My class is %@", [myObject className]); Testing for general class membership (subclasses included): if ([myObject isKindOfClass:[UIControl class]]) { // something  } Testing for specific class membership (subclasses excluded): if ([myObject isMemberOfClass:[NSString class]]) { // something string specific } Total 67 Pages 21
  • 22. Working with Objects  Identity v.s. Equality  Identity—testing equality of the pointer values  if (object1 == object2) { NSLog(@"Same exact object instance"); } Equality—testing object attributes if ([object1 isEqual: object2]) { NSLog(@"Logically equivalent, but may be different object instances"); } Total 67 Pages 22
  • 23. -description   NSObject implements -description - (NSString *)description; Objects represented in format strings using %@  When an object appears in a format string, it is asked for its description   [NSString stringWithFormat: @”The answer is: %@”, myObject]; You can log an object’s description with: NSLog([anObject description]); Your custom subclasses can override description to return more specific information Total 67 Pages 23
  • 24. Foundation Framework  Foundation Classes ◦ NSObject  String  NSString / NSMutableString  Collection     NSArray / NSMutableArray NSDictionary / NSMutableDictionary NSSet / NSMutableSet NSNumber  Others  NSData / NSMutableData  NSDate / NSCalendarDate Total 67 Pages 24
  • 25. More OOP Info  Tons of books and articles on OOP  Objective-C 2.0 Programming Language Total 67 Pages 25
  • 26. Outlines  Objective-C basics  Building an Application  Sensor programming (accelerometer, GPS, microphone…)  Audio Libraries Total 67 Pages 26
  • 27. Anatomy of an Application  Compiled code  Nib files   ◦ Your code ◦ Frameworks ◦ UI elements and other objects ◦ Details about object relations Resources (images, sounds, strings, etc) Info.plist file (application configuration) Total 67 Pages 27
  • 29. App Lifecycle  Main function  UIApplicationMain which Info.plist to figure out what nib to load.  MainWindow.xib contains the connections for our application.  AppDelegate  ViewController.xib  View – handle UI events Total 67 Pages 29
  • 32. Model  Manages the app data and state  Note concerned with UI or presentation  Often persists somewhere  Same model should be reusable, unchanged in different interfaces Total 67 Pages 32
  • 33. View  Present the Model to the user in an appropriate interface  Allows user to manipulate data  Does not store any data  ◦ (except to cache state) Easily reusable & configurable to display different data Total 67 Pages 33
  • 34. Controller  Intermediary between Model & View  Updates the view when the model changes  Updates the model when the user manipulates the view  Typically where the app logic lives Total 67 Pages 34
  • 35. Outlines  Objective-C basics  Building an Application  Sensor programming (accelerometer, GPS, microphone, …)  Audio Libraries Total 67 Pages 35
  • 36. Accelerometer   What are the accelerometers? ◦ Measure changes in force What are the uses?  Physical Orientation vs. Interface Orientation ◦ Ex: Photos & Safari Total 67 Pages 36
  • 37. Orientation-Related Changes   Getting the physical orientation ◦ UIDevice class  UIDeviceOrientationDidChangeNotification Getting the interface orientation ◦ UIApplication class  statusBarOrientation property ◦ UIViewController class  interfaceOrientation property Total 67 Pages 37
  • 38. Shake Undo!  UIEvent type ◦ @property(readonly) UIEventType type; ◦ @property(readonly) UIEventSubtype subtype; ◦ UIEventTypeMotion ◦ UIEventSubtypeMotionShake Total 67 Pages 38
  • 39. Getting raw Accelerometer Data  3-axis data  Configurable update frequency (10-100Hz)  Sample Code (AccelerometerGraph)  Class  Protocol ◦ UIAccelerometer ◦ UIAcceleration ◦ UIAccelerometerDelegate Total 67 Pages 39
  • 40. Getting raw Accelerometer Data -(void)initAccelerometer{ [[UIAccelerometer sharedAccelerometer] setUpdateInterval: (1.0 / 100)]; [[UIAccelerometer sharedAccelerometer] setDelegate: self]; } -(void)accelerometer: (UIAccelerometer*)accelerometer didAccelerate: (UIAcceleration*) acceleration { double x, y, z; x = acceleration.x; y = acceleration.y; z = acceleration.z; //process the data… } -(void)disconnectAccelerometer{ [[UIAccelerometer sharedAccelerometer] setDelegate: nil]; } Total 67 Pages 40
  • 41. Filtering Accelerometer Data  Low-pass filter  High-pass filter ◦ Isolates constant acceleration ◦ Used to find the device orientation ◦ Shows instantaneous movement only ◦ Used to identify user-initiated movement Total 67 Pages 41
  • 44. Applying Filters  Simple low-pass filter example #define FILTERFACTOR 0.1 Value = (newAcceleration * FILTERFACTOR) + (previousValue * (1.0 – FILTERFACTOR)); previousValue = value;  Simple high-pass filter example lowpassValue = (newAcceleration * FILTERFACTOR) + (previousValue * (1.0 – FILTERFACTOR)); previousLowPassValue = lowPassValue; highPassValue = newAcceleration – lowPassValue; Total 67 Pages 44
  • 45. GPS  Classes  Protocol ◦ CLLocationManager ◦ CLLocation ◦ CLLocationManagerDelegate Total 67 Pages 45
  • 46. Getting a Location  Starting the location service -(void)initLocationManager{ CLLocationManager* locManager = [[CLLocationManager alloc] init]; locManager.delegate = self; [locManager startUpdatingLocation]; }  Using the event data -(void)locationManager: (CLLocationManager*)manager didUpdateToLocation: (CLLocation*)newLocation fromLocation: (CLLocation*)oldLocation{ NSTimerInterval howRecent = [newLocation.timestamp timeIntervalSinceNow]; if(howRecent < -10) return; if(newLocation.horizontalAccuracy > 100) return; //Use the coordinate data. double lat = newLocation.coordinate.latitude; double lon = newLocation.coordinate.longitude; } Total 67 Pages 46
  • 47. Getting a Heading  Geographic North  Magnetic North ◦ CLLocationDirection trueHeading ◦ CLLocationDirection magneticHeading -(void)locationManager: (CLLocationManager *)manager didUpdateHeading:(CLHeading*)newHeading{ //Use the coordinate data. CLLocationDirection heading = newHeading.trueHeading; CLLocationDirection magnetic = newHeading.magneticHeading; } Total 67 Pages 47
  • 48. Microphone  We will cover it in the audio library… Total 67 Pages 48
  • 49. Outlines  Objective-C basics  Building an Application  Sensor programming (accelerometer, GPS, microphone…)  Audio Libraries Total 67 Pages 49
  • 50. Audio Libraries  System Sound API – short sounds  AVAudioPlayer – ObjC, simple API  Audio Session - Audio Toolbox  Audio Queue - Audio Toolbox  Audio Units  OpenAL  MediaPlayer Framework Total 67 Pages 50
  • 51. AVAudioPlayer       Play longer sounds (> 5 seconds) Locally stored files or in-memory (no network streaming) Can loop, seek, play, pause Provides metering Play multiple sounds simultaneously Cocoa-style API  Supports many more formats  Sample Code: avTouch ◦ Initialize with file URL or data ◦ Allows for delegate ◦ Everything the AudioFile API supports Total 67 Pages 51
  • 52. AVAudioPlayer  Create from file URL or data AVAudioPlayer *player; NSString *path = [[NSBundle mainBundle] pathForResource:… ofType:…]; NSURL *url = [NSURL fileURLWithPath:path]; player = [[AVAudioPlayer allow] initWithContentsOfURL:url]; [player prepareToPlay];  Simple methods for starting/stopping If(!player.playing){ [player play]; }else{ [player pause]; } Total 67 Pages 52
  • 53. Audio Sessions   Handles audio behavior at the application, inter-application, and device levels ◦ ◦ ◦ ◦ Ring/Silent switch? iPod audio continue? Headset plug / unplug? Phone call coming? Sample Code: avTouch & aurioTouch Total 67 Pages 53
  • 54. Audio Sessions  Six audio session categories ◦ ◦ ◦ ◦ ◦ ◦ Ambient Solo Ambient (Default session) Media playback Recording Play and record Offline audio processing Total 67 Pages 54
  • 55. Audio Queue      Audio File Stream Services & Audio Queue Services Supports wider variety of formats Finer grained control over playback ◦ Streaming audio over network ◦ Cf: AVAudioPlayer(local) Allows queueing of consecutive buffers for seamless playback ◦ Callback functions for reusing buffers Sample code: SpeakHere Total 67 Pages 55
  • 56. Audio Units  For serious audio processing  Graph-based audio ◦ ◦ ◦ ◦ Rate or format conversion Real time input/output for recording & playback Mixing multiple streams VoIP (Voice over Internet Protocol).  Very, very powerful.  Sample code: aurioTouch Total 67 Pages 56
  • 57. Audio Units   Lowest programming layer in iOS audio stack ◦ Real-time playback of synthesized sounds ◦ Low-latency I/O ◦ Specific audio unit features Otherwise, look first at the Media Player, AV Foundation, OpenAL, or Audio Toolbox! Total 67 Pages 57
  • 58. Audio Units  Ex: Karaoke app in iPhone ◦ real-time input from mic ◦ Real-time output to speaker ◦ Audio Unit provides excellent responsiveness ◦ Audio Unit controls audio flow to do pitch tracking, voice enhancement, iPod equalization, and etc. Total 67 Pages 58
  • 59. OpenAL  High level, cross-platform API for 3D audio mixing  Models audio in 3D space  Sample code: oalTouch  More information: http://www.openal.org/ ◦ Great for games ◦ Mimics OpenGL conventions ◦ Buffers: Container for Audio ◦ Sources: 3D point emitting Audio ◦ Listener: Position where Sources are heard Total 67 Pages 59
  • 60. MediaPlayer Framework  Tell iPod app to play music  Access to entire music library ◦ For playback, not processing  Easy access through MPMediaPickerController  Deeper access through Query APIs  Sample code: AddMusic Total 67 Pages 60
  • 61. Others  Accelerate Framework  Bonjour and NSStream  ◦ C APIs for vector and matrix math, digital signal processing large number handling, and image processing ◦ vDSP programming guide The Synthesis ToolKit in C++ (STK) and OSC Total 67 Pages 61
  • 62. More Info for Beginners  iPhone Application Programming (Standford University - iTunes University)  Dan Pilone & Tracey Pilone. Head First iPhone Development. Total 67 Pages 62
  • 63.  Thank you and good luck to your final projects! Total 67 Pages 63