• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Formacion en movilidad: Conceptos de desarrollo en iOS (III)
 

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

on

  • 357 views

En esta tercera sesión formativa, impartida por Sergi Hernando, CTO de Mobivery, se trataron los siguientes conceptos: UIWebView, View Cotroller en iPad y el Simulador

En esta tercera sesión formativa, impartida por Sergi Hernando, CTO de Mobivery, se trataron los siguientes conceptos: UIWebView, View Cotroller en iPad y el Simulador

Statistics

Views

Total Views
357
Views on SlideShare
357
Embed Views
0

Actions

Likes
0
Downloads
1
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

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

    Formacion en movilidad: Conceptos de desarrollo en iOS (III) Formacion en movilidad: Conceptos de desarrollo en iOS (III) Presentation Transcript

    • Televisió de CatalunyaFormación en movilidadConceptos de desarrollo en iOS3ª sesión mayo 20131
    • Qué veremos hoyRepaso de la sesión anteriorUIWebViewView Cotroller en iPadSimulador2
    • RecursosTutoriales de Ray Wenderlichwww.raywenderlich.com/tutorialsCursos de Stanford en iTunes Uitunes.stanford.eduiOS Developer Librarydeveloper.apple.com/library/ios3
    • RepasoView ControllerUIViewController4
    • RepasoNavigation BarUINavigationItemUIBarButtonItem - NSString - UIBarButtonItem5
    • RepasoUIBarButtonItemself.navigationItem.rightBarButtonItem6
    • RepasoUIStoryboardSegueModal7
    • Repaso// MasterViewController.m- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{if ([[segue identifier] isEqualToString:@"newDetail"]) {! ! NewVideoViewController *viewController = (NewVideoViewController *)[segue destinationViewController];! ! viewController.masterViewController = self;! }}8
    • Repaso// NewVideoViewController.m- (IBAction)done:(id)sender {! [self dismissViewControllerAnimated:YES completion:^{! ! NSDictionary *values = @{! ! ! @"title": self.videoTitle.text, @"author": self.videoAuthor.text, @"url": self.videoURL.text! ! };! ! [self.masterViewController insertNewObject:values];! }];}9
    • Repaso// MasterViewController.m- (void)insertNewObject:(NSDictionary *)values{// ...[newManagedObject setValue:[NSDate date] forKey:@"timeStamp"];[newManagedObject setValue:[values objectForKey:@"title"] forKey:@"title"];[newManagedObject setValue:[values objectForKey:@"author"] forKey:@"author"];[newManagedObject setValue:[values objectForKey:@"url"] forKey:@"url"];// ...}10
    • Debugging11
    • UIWebView// DetailViewController.h@interface DetailViewController : UIViewController <UISplitViewControllerDelegate, UIWebViewDelegate>@property (strong, nonatomic) id detailItem;@property (nonatomic, weak) IBOutlet UILabel *titleLabel;@property (nonatomic, weak) IBOutlet UILabel *authorLabel;@property (nonatomic, weak) IBOutlet UIWebView *webView;@end12
    • UIWebView// DetailViewController.m- (void)configureView{// ...self.titleLabel.text = [self.detailItem valueForKey:@"title"];self.authorLabel.text = [self.detailItem valueForKey:@"author"];}13
    • UIWebView// DetailViewController.m- (void)configureView{// ...self.titleLabel.text = [self.detailItem valueForKey:@"title"];self.authorLabel.text = [self.detailItem valueForKey:@"author"];NSURL *theURL = [[NSURL alloc] initWithString:[self.detailItem valueForKey:@"url"]];NSURLRequest *request = [[NSURLRequest alloc] initWithURL:theURL];[self.webView loadRequest:request];}14
    • UIWebViewUIWebViewDelegate// DetailViewController.m- (void)configureView{// ...self.titleLabel.text = [self.detailItem valueForKey:@"title"];self.authorLabel.text = [self.detailItem valueForKey:@"author"];NSURL *theURL = [[NSURL alloc] initWithString:[self.detailItem valueForKey:@"url"]];NSURLRequest *request = [[NSURLRequest alloc] initWithURL:theURL];[self.webView setDelegate:self];[self.webView loadRequest:request];}15
    • UIWebViewUIWebViewDelegate// DetailViewController.m- (void)configureView{// ...self.titleLabel.text = [self.detailItem valueForKey:@"title"];self.authorLabel.text = [self.detailItem valueForKey:@"author"];NSURL *theURL = [[NSURL alloc] initWithString:[self.detailItem valueForKey:@"url"]];NSURLRequest *request = [[NSURLRequest alloc] initWithURL:theURL];[self.webView setDelegate:self];[self.webView loadRequest:request];}#pragma mark - UIWebViewDelegate- (void)webViewDidStartLoad:(UIWebView *)webView {}- (void)webViewDidFinishLoad:(UIWebView *)webView {}16
    • UIWebViewUIActivityIndicatorView// DetailViewController.h@interface DetailViewController : UIViewController <UISplitViewControllerDelegate, UIWebViewDelegate>@property (strong, nonatomic) id detailItem;@property (nonatomic, weak) IBOutlet UILabel *titleLabel;@property (nonatomic, weak) IBOutlet UILabel *authorLabel;@property (nonatomic, weak) IBOutlet UIWebView *webView;@property (nonatomic, strong) IBOutlet UIActivityIndicatorView *spinner;@end17
    • UIWebViewUIActivityIndicatorView// DetailViewController.m- (void)configureView{// ...self.titleLabel.text = [self.detailItem valueForKey:@"title"];self.authorLabel.text = [self.detailItem valueForKey:@"author"];self.spinner =[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];self.spinner.center = self.view.center;NSURL *theURL = [[NSURL alloc] initWithString:[self.detailItem valueForKey:@"url"]];NSURLRequest *request = [[NSURLRequest alloc] initWithURL:theURL];[self.webView setDelegate:self];[self.webView loadRequest:request];}#pragma mark - UIWebViewDelegate- (void)webViewDidStartLoad:(UIWebView *)webView {}- (void)webViewDidFinishLoad:(UIWebView *)webView {}18
    • UIWebViewUIActivityIndicatorView// DetailViewController.m- (void)configureView{// ...self.titleLabel.text = [self.detailItem valueForKey:@"title"];self.authorLabel.text = [self.detailItem valueForKey:@"author"];self.spinner =[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];self.spinner.center = self.view.center;NSURL *theURL = [[NSURL alloc] initWithString:[self.detailItem valueForKey:@"url"]];NSURLRequest *request = [[NSURLRequest alloc] initWithURL:theURL];[self.webView setDelegate:self];[self.webView loadRequest:request];}#pragma mark - UIWebViewDelegate- (void)webViewDidStartLoad:(UIWebView *)webView {dispatch_async(dispatch_get_main_queue(), ^{});}- (void)webViewDidFinishLoad:(UIWebView *)webView {}19
    • UIWebViewUIActivityIndicatorView// DetailViewController.m- (void)configureView{// ...self.titleLabel.text = [self.detailItem valueForKey:@"title"];self.authorLabel.text = [self.detailItem valueForKey:@"author"];self.spinner =[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];self.spinner.center = self.view.center;NSURL *theURL = [[NSURL alloc] initWithString:[self.detailItem valueForKey:@"url"]];NSURLRequest *request = [[NSURLRequest alloc] initWithURL:theURL];[self.webView setDelegate:self];[self.webView loadRequest:request];}#pragma mark - UIWebViewDelegate- (void)webViewDidStartLoad:(UIWebView *)webView {dispatch_async(dispatch_get_main_queue(), ^{[self.view addSubview:self.spinner];[self.spinner startAnimating];});}- (void)webViewDidFinishLoad:(UIWebView *)webView {}20
    • UIWebViewUIActivityIndicatorView// DetailViewController.m- (void)configureView{// ...self.titleLabel.text = [self.detailItem valueForKey:@"title"];self.authorLabel.text = [self.detailItem valueForKey:@"author"];self.spinner =[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];self.spinner.center = self.view.center;NSURL *theURL = [[NSURL alloc] initWithString:[self.detailItem valueForKey:@"url"]];NSURLRequest *request = [[NSURLRequest alloc] initWithURL:theURL];[self.webView setDelegate:self];[self.webView loadRequest:request];}#pragma mark - UIWebViewDelegate- (void)webViewDidStartLoad:(UIWebView *)webView {dispatch_async(dispatch_get_main_queue(), ^{[self.view addSubview:self.spinner];[self.spinner startAnimating];});}- (void)webViewDidFinishLoad:(UIWebView *)webView {dispatch_async(dispatch_get_main_queue(), ^{});}21
    • UIWebViewUIActivityIndicatorView// DetailViewController.m- (void)configureView{// ...self.titleLabel.text = [self.detailItem valueForKey:@"title"];self.authorLabel.text = [self.detailItem valueForKey:@"author"];self.spinner =[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];self.spinner.center = self.view.center;NSURL *theURL = [[NSURL alloc] initWithString:[self.detailItem valueForKey:@"url"]];NSURLRequest *request = [[NSURLRequest alloc] initWithURL:theURL];[self.webView setDelegate:self];[self.webView loadRequest:request];}#pragma mark - UIWebViewDelegate- (void)webViewDidStartLoad:(UIWebView *)webView {dispatch_async(dispatch_get_main_queue(), ^{[self.view addSubview:self.spinner];[self.spinner startAnimating];});}- (void)webViewDidFinishLoad:(UIWebView *)webView {dispatch_async(dispatch_get_main_queue(), ^{[self.spinner stopAnimating];[self.spinner removeFromSuperview];});}22
    • Coffee Break!23
    • MVCView Controller LifecycleviewDidLoad:viewWillAppear:viewDidAppear:didReceiveMemoryWarning:24
    • MVCView Controller LifecycleviewDidLoad:“This method is called after the view controller has loaded its view hierarchy into memory.You usually override this method to perform additionalinitialization on views that were loaded from nib files”- (void)viewDidLoad{[super viewDidLoad];self.spinner =[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];self.spinner.center = self.view.center;}25
    • MVCView Controller LifecycleviewWillAppear:“This method is called before the receiver’s view is about to be added to a view hierarchy.You can override this method to perform custom tasksassociated with displaying the view”- (void)viewDidLoad{[super viewDidLoad];self.spinner =[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];self.spinner.center = self.view.center;}- (void)viewWillAppear:(BOOL)animated{[super viewWillAppear:animated];self.titleLabel.text = [self.detailItem valueForKey:@"title"];self.authorLabel.text = [self.detailItem valueForKey:@"author"];}26
    • MVCView Controller LifecycleviewDidAppear:“You can override this method to perform additionaltasks associated with presenting the view”- (void)viewDidLoad{[super viewDidLoad];self.spinner =[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];self.spinner.center = self.view.center;}- (void)viewWillAppear:(BOOL)animated{[super viewWillAppear:animated];self.titleLabel.text = [self.detailItem valueForKey:@"title"];self.authorLabel.text = [self.detailItem valueForKey:@"author"];}- (void)viewDidAppear:(BOOL)animated{[super viewDidAppear:animated];NSURL *theURL = [[NSURL alloc] initWithString:[self.detailItem valueForKey:@"url"]];NSURLRequest *request = [[NSURLRequest alloc] initWithURL:theURL];[self.webView setDelegate:self];[self.webView loadRequest:request];}27
    • MVCView Controller LifecycledidReceiveMemoryWarning:“You can override this method to release anyadditional memory used by your viewcontroller”28
    • EjercicioNewVideoView Controller en iPad29
    • iOS SimulatorFileOpen Printer SimulatorSave Screen Shot ⌘S30
    • iOS SimulatorHardwareDeviceiPad 2, miniiPad (Retina)iPhone 3G, 3GSiPhone (Retina 3.5-inch) 4, 4SiPhone (Retina 4-inch) 5, iPod TouchVersion5.0 (9A334) WWDC 20115.1 (9B176)6.0 (10A403) WWDC 20126.1 (10B141)31
    • iOS SimulatorHardwareRotate Left ⌘←Rotate Right ⌘→Shake Gesture ^⌘Z32
    • iOS SimulatorHardwareHome ⇧⌘HLock ⌘L33
    • iOS SimulatorHardwareSimulate Memory Warning didReceiveMemoryWarning:Toggle In-Call Status Bar ⌘TSimulate Hardware KeyboardTV OutDisabled640 x 480720 x 4801024 x 7681280 x 720 (720p)1920 x 1024 (1080p)34
    • iOS SimulatorDebugToggle Slow Animations35
    • iOS SimulatorDebugColor Blended Layers Reduce amount of red to improve performanceColor Copied ImagesColor Misaligned ImagesColor Offscreen-Rendered36
    • iOS SimulatorDebugLocationNoneCustom Location...Apple StoresAppleCity Bicycle RideCity RunFreeway Drive37
    • iOS SimulatorWindowScale100% ⌘175% ⌘250% ⌘338
    • InstrumentsProfiling⌘I39
    • InstrumentsAllocations40
    • InstrumentsAllocations- (void)didReceiveMemoryWarning{[super didReceiveMemoryWarning];self.webView = nil;self.spinner = nil;self.authorLabel = nil;self.titleLabel = nil;self.detailItem = nil;}41
    • InstrumentsLeaks42
    • ¡Gracias!43