• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Tutorial 3
 

Tutorial 3

on

  • 313 views

 

Statistics

Views

Total Views
313
Views on SlideShare
300
Embed Views
13

Actions

Likes
0
Downloads
1
Comments
0

1 Embed 13

http://e-uic.com 13

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Tutorial 3 Tutorial 3 Presentation Transcript

    • Capturar imágenes desde la cámara del iPhoneUtilizaremos el controlador UIImagePickerController paraacceder a las imágenes guardadas en el dispositivo o capturarimágenes desde un iPhone.
    • UIImagePickerController en acción Crear un nuevo proyecto en Xcode de tipo “View-Based Application”
    • Agregar los siguientes elementos en “NombreAppViewController.h”:@interface CamAppViewController : UIViewController<UIImagePickerControllerDelegate, UINavigationControllerDelegate> {UIImageView *imagenView;UIButton *abrirGaleria;UIButton *tomarFoto;}
    • @property (nonatomic, retain) IBOutlet UIImageView *imagenView;@property (nonatomic, retain) IBOutlet UIButton *abrirGaleria;@property (nonatomic, retain) IBOutlet UIButton *tomarFoto;- (IBAction)abrirGaleria:(id)sender;- (IBAction)tomarFoto:(id)sender;
    • Abrir el archivo “NombreAppViewController.xib” (Interface Builder) y agregar 1 UIImageView y 2 UIButton
    • Desde el Connections Inspector enlazar los elementos creados en Interface Builder con Xcode:
    • #import “CamAppViewController.h”@implementation CamAppViewController@synthesize imagenView, abrirGaleria, tomarFoto;- (IBAction)abrirGaleria:(id)sender{// Inicia el ControladorUIImagePickerController * picker = [[UIImagePickerController alloc] init];// Define el Delegatepicker.delegate = self;// Establece el origen de la imagenpicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;// Agrega la vista del controlador a la pantalla[self presentModalViewController:picker animated:YES];}- (IBAction)tomarFoto:(id)sender{UIImagePickerController * picker = [[UIImagePickerController alloc] init];
    • Compilar y ejecutar: