Formacion en movilidad: Conceptos de desarrollo en iOS (II)

Post on 09-May-2015

215 views 0 download

description

En esta segunda sesión formativa, impartida por Sergi Hernando, CTO de Mobivery, se habló de Storyboards, MVC y iOS simulator

Transcript of Formacion en movilidad: Conceptos de desarrollo en iOS (II)

Televisió de CatalunyaFormación en movilidad

Conceptos de desarrollo en iOS

1

Qué veremos hoy

Storyboards

MVC

iOS simulator

2

Storyboards

MyVideos/en.lproj/MainStoryboard_iPhone.storyboard

3

Storyboards

MyVideos/en.lproj/MainStoryboard_iPhone.storyboard

4

StoryboardsScenes

iPhone

Navigation Controller“A navigation controller manages a stack of view controllers to

provide a drill-down interface for hierarchical content”

5

StoryboardsScenes

iPhone

View Controller“View controllers are the link between an app’s data and its

visual appearance”

6

StoryboardsScenes

iPhone

Segue“Segues are a standard way to transition from one view

controller to another”

7

StoryboardsNavigation Controller Scene

8

StoryboardsNavigation Controller Scene

Componentes

• Navigation Controller• Navigation Bar

backBarButtonItem, title, rightBarButtonItem

• ToolbartoolBarItems

• First ResponderObjeto que recibe en primer lugar eventos de UI

• ExitAcción para ‘deshacer’ la navegación (unwind segue)

• Relationship “root view controller” to MasterControlador inicial

9

StoryboardsNavigation Controller Scene

Pila de navegación

10

StoryboardsMaster Scene

Componentes

11

StoryboardsMaster Scene

Table View

dataSource: MasterViewController ⤺ UITableViewDataSourcedelegate: MasterViewController ⤺ UITableViewDelegate

12

StoryboardsMaster Scene

Table View

// MasterViewController.m

#pragma mark - UITableViewDataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;

#pragma mark - UITableViewDelegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;

13

StoryboardsMaster Scene

Table View Cell

selection: push Detail View Controller

Push segue from Cell to Detail14

StoryboardsMaster Scene

Table View Cell

// MasterViewController.m

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ if([[segue identifier] isEqualToString:@"showDetail"]) { // ... }}

15

StoryboardsDetail Scene

Componentes

16

StoryboardsDetail Scene

View

UIView

17

StoryboardsDetail Scene

Label

18

StoryboardsScenes

iPad

Split View ControllerMaster View Controller + Detail View Controller

19

StoryboardsScenes

iPad

Navigation ControllerMaster View Controller

20

StoryboardsScenes

Navigation ControllerDetail View Controller

21

StoryboardsDiferencias iPhone-iPad

En Table View Cell no hay selection: Push Detail View Controller

22

StoryboardsDiferencias iPhone-iPad

prepareForSegue:sender: no se ejecuta

23

StoryboardsDiferencias iPhone-iPad

Detail View Controller se actualiza con tableView:didSelectRowAtIndexPath:- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { // ... }}

24

25

26

Coffee Break!

27

MVC

View Controller desde 0Vista modal en iPhone para crear un vídeo nuevo

Navigation Bar con ‘Cancel’ y ‘Done’Acciones desde la vista modal

Adaptar Master View ControllerRecoger datos introducidos en la vista modal

Muy breve introducción a Core DataPersistencia de los datos recogidos

Replicar en iPadRetocar la vista de iPhone

28

MVC

UIWebViewCarga de una URL en vista web

Loading...Spinner para feedback durante la carga de datos

29

iOS Simulator

Hardware > Device iPad iPad (Retina) iPhone iPhone (Retina 3.5-inch) iPhone (Retina 4-inch)

Hardware > Version 5.0 (9A334) 5.1 (9B176) 6.0 (10A403) 6.1 (10B141)

30

iOS Simulator

Debug > Location

31

iOS Simulator

32

Recursos

Tutoriales de Ray Wenderlichwww.raywenderlich.com/tutorials

Cursos de Stanford en iTunes Uitunes.stanford.edu

iOS Developer Librarydeveloper.apple.com/library/ios

33

¡Gracias!

34