Desenvolvimento iOS - Aula 4
Upcoming SlideShare
Loading in...5
×
 

Desenvolvimento iOS - Aula 4

on

  • 1,068 views

Quarta aula do curso de iOS ministrado na DueCappa.

Quarta aula do curso de iOS ministrado na DueCappa.

Statistics

Views

Total Views
1,068
Views on SlideShare
1,068
Embed Views
0

Actions

Likes
0
Downloads
39
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Apple Keynote

Usage Rights

CC Attribution License

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
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Desenvolvimento iOS - Aula 4 Desenvolvimento iOS - Aula 4 Presentation Transcript

  • Desenvolvimento deaplicativos mobile para iOS Aula 4 - Conhecendo alguns componentes
  • Componentes•UIImageView•UIScrollView•UIWebView
  • UIImageView • Mostrar uma imagem ou uma série animada de imagenshttp://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIImageView_Class/Reference/Reference.html
  • - (id)initWithImage:(UIImage *)image@property(nonatomic, retain) UIImage *image- (void)startAnimating- (void)stopAnimating@property(nonatomic) NSTimeInterval animationDuration@property(nonatomic, copy) NSArray *animationImages@property(nonatomic) NSInteger animationRepeatCount@property(nonatomic, getter=isHighlighted) BOOLhighlighted@property(nonatomic, retain) UIImage *highlightedImage
  • UIImage • Objeto de alto nível para exibir imagens • As instâncias são imutáveis • Provê várias formas de exibir imagenshttp://developer.apple.com/library/ios/#documentation/uikit/reference/UIImage_Class/Reference/Reference.html#//apple_ref/ occ/instm/UIImage/resizableImageWithCapInsets:
  • + (UIImage *)imageNamed:(NSString *)name+ (UIImage *)imageWithContentsOfFile:(NSString *)path+ (UIImage *)imageWithData:(NSData *)data+ (UIImage *)animatedImageWithImages:(NSArray *)imagesduration:(NSTimeInterval)duration- (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets
  • Convenção de nomes• Padrão: <ImageName><device_modifier>.<filename_extension>• Alta resolução: <ImageName>@2x<device_modifier>.<filename_extension>• Exemplos: Button.png, Button~ipad.png, Button@2x~ipad.png, Button@2x~iphone.png [UIImage:imageNamed:@"Button"]
  • Demo
  • UIScrollView • Provê suporte para exibir conteúdos que são maiores que a área de exibição da tela • Permite ao usuário rolar a tela usando “Swiping Gestures” e dar zoom usando “Pinching Gestures”http://developer.apple.com/library/ios/#DOCUMENTATION/WindowsViews/Conceptual/UIScrollView_pg/Introduction/ Introduction.html#//apple_ref/doc/uid/TP40008179-CH1-SW1
  • scrollView.contentSize = CGSizeMake(1920, 1080);
  • - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { return self.imageView;}
  • Demo
  • UIWebView • Componente para embutir conteúdo da web no aplicativo • Por padrão, um web view converte números de telefone para linkshttp://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html
  • - (void)loadRequest:(NSURLRequest *)request- (void)loadHTMLString:(NSString *)string baseURL:(NSURL*)baseURL@property(nonatomic, assign) id<UIWebViewDelegate>delegate- (void)stopLoading- (void)reload- (void)goBack- (void)goForward- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script
  • UIWebViewDelegate - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType: (UIWebViewNavigationType)navigationType- (void)webViewDidStartLoad:(UIWebView *)webView- (void)webViewDidFinishLoad:(UIWebView *)webView- (void)webView:(UIWebView *)webViewdidFailLoadWithError:(NSError *)error
  • Usando...- (BOOL)textFieldShouldReturn:(UITextField *)textField{ NSURLRequest* request = [NSURLRequest requestWithURL: [NSURL URLWithString:textField.text]]; [self.webView loadRequest:request]; [textField resignFirstResponder]; return YES;}
  • Demo