iOS immersion

Preview:

DESCRIPTION

Une présentation d'une heure sur les points techniques à connaître pour attaquer le développement sur iOS (iPhone, iPad, iPod Touch).

Citation preview

iOS ImmersionPascal Batty

vendredi 3 mai 13

Je Veux !

vendredi 3 mai 13

•Idée de génie

•Maquettes révolutionnaires

•API de fou

•App Mobile

vendredi 3 mai 13

Mobile ?vendredi 3 mai 13

Version ?

4.x5,7 %

5.x24,8 %

6.x69,5 %

Source : David Smith, 7 novembre 2012

vendredi 3 mai 13

Moyen ?vendredi 3 mai 13

vendredi 3 mai 13

Objective-CHistorique

vendredi 3 mai 13

Naissance d'Objective-C

1980

vendredi 3 mai 13

NeXTstep

1986

vendredi 3 mai 13

MacOS X

2001

vendredi 3 mai 13

iphone

2007

vendredi 3 mai 13

iPhone OS SDK

2008

vendredi 3 mai 13

iOS 3 iOS 4 iOS 5 iOS 6 …

2009 2010 2011 2012

Xcode 3.2 Xcode 4.0

vendredi 3 mai 13

Objective-CTechnique

vendredi 3 mai 13

FrameworkRuntime

Compilo Langage

ObjC

vendredi 3 mai 13

vendredi 3 mai 13

struct

Pointeurs

Prototypesmalloc()

int[]

char*

int main(int argc, char** argv)Références

Headersuint

typedef

enumtry-catch

#ifdef

#define

Allocation

Désallocation

vendredi 3 mai 13

vendredi 3 mai 13

Pointeurs

vendredi 3 mai 13

vendredi 3 mai 13

@class

Héritage

Protocoles

@protocol

NSString

Méthode d’instance

Méthode de classe

NSObject

Propriétés

@property

Polymorphisme

RetainRelease

nil

vendredi 3 mai 13

NSObject

vendredi 3 mai 13

nil

vendredi 3 mai 13

Boîte à outils

• NSString

• NSArray

• NSDictionary

• NSSet

vendredi 3 mai 13

Boîte à outils

• NSString

• NSArray

• NSDictionary

• NSSet

• NSMutableString

• NSMutableArray

• NSMutableDictionary

• NSMutableSet

vendredi 3 mai 13

Syntaxe

vendredi 3 mai 13

Déclaration

#import <Foundation/Foundation.h>

@interface Person:NSObject

@property NSString *name;

- (id)initWithName:(NSString *)name;

+ (id)personWithName:(NSString *)name;

@end

vendredi 3 mai 13

Implémentation#import "Person.h"

@implementation Person@synthesize name = _name;

- (id)initWithName:(NSString *)name {…}

+ (id)personWithName:(NSString *)name {…}@end

vendredi 3 mai 13

Envoi de message

[teller sayHello];

teller.sayHello();

[teller sayHelloTo:person];

teller.sayHello(person);

ObjC

Java/C#

ObjC

Java/C#

vendredi 3 mai 13

Envoi de message

ObjC

Java/C#

[teller say:message to:person];

teller.say(message, person);

vendredi 3 mai 13

Sélecteur

say:to:

vendredi 3 mai 13

Initialisation, Propriétés

Person *person1 = [[Person alloc] init];

Person *person2 = [[Person alloc] initWithName:@"Noé"];

Person *person3 = [Person personWithName:@"Jim"];

[person1 setName:@"Jen"];

person2.name = @"Pam"];

NSString *name = [person1 name];

NSString *otherName = person2.name;

Setter

Getter

vendredi 3 mai 13

Gestion de la mémoire

vendredi 3 mai 13

vendredi 3 mai 13

Reference Counting

vendredi 3 mai 13

Setter (retain)

- (void)setText:(NSString *)textValue {

if (textValue != _text) {

[textValue retain];

[_text release];

_text = textValue;

}

}

vendredi 3 mai 13

Ouf…

Automatic Reference Counting

vendredi 3 mai 13

Anatomie d'une App

vendredi 3 mai 13

Révisions

ModelView

Controller

vendredi 3 mai 13

UIKit

UIView

UILabelUIControl

UIButton Etc…

vendredi 3 mai 13

Interface Utilisateur

ViewController Interface

Outlets

Actions

vendredi 3 mai 13

View≠

ViewController

vendredi 3 mai 13

Delegation

UITextField

@protocol UITextFieldDelegate• textFieldShouldBeginEditing:

• textFieldDidBeginEditing:

• textFieldShouldEndEditing:

• textFieldDidEndEditing:

• textField:shouldChangeCharactersInRange:replacementString:

• textFieldShouldClear:

• textFieldShouldReturn:

vendredi 3 mai 13

Delegation

delegateUITextField

vendredi 3 mai 13

Delegation

delegate

L’utilisateur a appuyé sur Retour !

UITextField

[delegate textFieldShouldReturn:self]

vendredi 3 mai 13

Delegation

delegate

L’utilisateur a appuyé sur Retour !

UITextField

Ok, je lance une recherche

[delegate textFieldShouldReturn:self]

vendredi 3 mai 13

Là où tout commence

AppDelegate

vendredi 3 mai 13

Pour commencer

http://developer.apple.com/ios

vendredi 3 mai 13

Merci

vendredi 3 mai 13