SlideShare uma empresa Scribd logo
1 de 42
Baixar para ler offline
Three20
Como usar esta biblioteca e facilitar sua vida



Gust av o Am broz io
O que é o Three20

Biblioteca desenvolvida por Joe Hewitt
(Facebook app)

MVC para tabelas e listas

Novos Widgets

Rede e cache

Estilo (Objective-CSS)
Exemplos
Instalação
Baixar do github (git clone git://github.com/uprise78/three20-P31.git)

Nas prefs do Xcode, incluir a pasta de src do Three20 como um “Source Tree”

Arrastar o Three20.xcodeproj para o root do seu projeto com o “Reference Type” relativo ao
Source Tree que você criou e SEM copiar.

Arrastar o libThree20.a para o link libraries do seu Target.

Configurar o Three20 como dependência do seu Target. Aproveitar e incluir o QuartzCore
framework ao Target.

Inclusão do bundle to Three20 no projeto, também sem copiar e relativo ao Source Tree.

Nas propriedades do projeto:

   Incluir o Source Tree do Three20 no “Header Search Paths”

   Incluir as flags “-ObjC” e “-all_load” no “Other Linker Flags”

Incluir o “Three20/Three20.h” nos seus headers.
Multifacetado!

              Photo Browser




    TTStyle              Novos Widgets


Navegação interna
imitando web via              Utilitários
     “URLs”
Photo Browser
Photo Browser
                                                                   Three20 Photo Browsing System                                                                                                                  class

                                                                                               Data Interfaces                                                                                                    protocol
                                                             The arrows indicate either the message(s) that a class sends *or* how it uses another class.
                                                                  If a class implements a protocol, the protocol will be drawn inside the class's box.



                          scrollView:didMoveToPageAtIndex:
                          scollView:shouldZoom:
                          many other optional methods                                                                        thumbsViewController:didSelectPhoto:
                                                              TTScrollView
TTScrollView                                                    Delegate
                                                                                                  TTThumbs                   thumbsViewController:shouldNavigateToPhoto:
                                                                                                ViewController
                                                              TTScrollView
                                                                                                   Delegate                                                    TTThumbsViewController
                          numberOfPagesInScrollView:
                          scrollView:pageAtIndex:
                                                              DataSource
                          scrollView:sizeOfPageAtIndex:                                                                                                                      tableView:objectForRowAtIndexPath:
                          many other optional methods                                                                                                                                   load:nextPage:


                                                                   TTPhotoViewController
     list of "pages"                                                                                                                                                                            TTTableView
 displayed horizontally                                                                                                                                                                         DataSource

                                                                                                                                                                TTThumbsDataSource
                                                                                                TTPhotoSource                                            TTPhotoSource                       TTThumbsTableView
                                                                                                  Delegate                                                 Delegate                          CellDelegate

     TTPhotoView
       TTPhotoView
         TTPhotoView                                                                                                                                                                 thumbsTableViewCell:didSelectPhoto:



                                                                                                                                                                                         TTThumbsTableViewCell


                                                                           photoAtIndex:                                                                       photoAtIndex:
     each TTPhotoView asynchronously                          loadPhotosFromIndex:toIndex:cachePolicy:
                                                                                                            photoSourceDidStartLoad               loadPhotosFromIndex:toIndex:cachePolicy:
         displays a single TTPhoto
                                                                                                            photoSourceDidFinishLoad:
                                                                                                            photoSource:didFailLoadWithError:
                                                                                                            photoSourceDidCancelLoad:




                           TTPhoto                                                                               TTPhotoSource

                                                              list of photos
                     Your TTPhoto                                                                        Your TTPhotoSource
                    Implementation
                                                                                                           Implementation
Implementando
                   Subclasse de TTPhotoSource
-   (BOOL)isLoading;
-   (BOOL)isLoaded;
-   (void)load:(TTURLRequestCachePolicy)cachePolicy more:(BOOL)more;
-   (void)cancel;
-   (NSInteger)numberOfPhotos;
-   (NSInteger)maxPhotoIndex;
-   (id<TTPhoto>)photoAtIndex:(NSInteger)index;




[_delegates perform:@selector(modelDidFinishLoad:) withObject:self];
TTPhoto
                  Subclasse de TTPhoto

- (NSString*)URLForVersion:(TTPhotoVersion)version {
  if (version == TTPhotoVersionLarge) {
    return _URL;
  } else if (version == TTPhotoVersionMedium) {
    return _URL;
  } else if (version == TTPhotoVersionSmall) {
    return _smallURL;
  } else if (version == TTPhotoVersionThumbnail) {
    return _thumbURL;
  } else {
    return nil;
  }
}
TTStyle

Inspirado no CSS do HTML

Catálogo do Look and Feel do seu app que pode mudar todo o look a
qualquer tempo

Sempre derivará do TTDefaultStyleSheet

[TTStyleSheet setGlobalStyleSheet:[[[MyStyleSheet alloc] init] autorelease]];

Repositórios de elementos globais como cores e fontes

Estilos complexos
Globais
@interface MyStyleSheet : TTDefaultStyleSheet

@property(nonatomic,readonly) UIColor* myFirstColor;
@property(nonatomic,readonly) UIFont* myFirstFont;

@end

@implementation MyStyleSheet

- (UIColor*)myFirstColor {
   return RGBCOLOR(80, 110, 140);                      UILabel* label;
}                                                      label.font = TTSTYLEVAR(myFirstFont);
                                                       label.textColor = TTSTYLEVAR(myFirstColor);
- (UIColor*)mySecondColor {
   return [UIColor grayColor];
}

- (UIFont*)myFirstFont {
   return [UIFont boldSystemFontOfSize:15];
}

- (UIFont*)mySecondFont {
   return [UIFont systemFontOfSize:14];
}

@end                                      http://mattvague.com/three20-stylesheets-tutorial
Estilos complexos

É uma cadeia de TTStyle. Cada TTStyle é uma
“caixa preta” que pode desenhar ou
simplesmente alterar o contexto.

O Sample TTCatalog é o mais completo guia de
estilos.

TTStyle.h

TTStyleBuilder (http://github.com/klazuka/TTStyleBuilder)
A cadeia

- (void)draw:(TTStyleContext*)context {

    // Modifica o context
    // Desenha algo usando o context

    // Chama o next!
    [self.next draw:context];
}
TTStyledTextLabel

- (TTStyle*)smallText {
  return [TTTextStyle styleWithFont:[UIFont systemFontOfSize:12] next:nil];
}

- (TTStyle*)floated {
  return [TTBoxStyle styleWithMargin:UIEdgeInsetsMake(0, 0, 5, 5)
                      padding:UIEdgeInsetsMake(0, 0, 0, 0)
                      minSize:CGSizeZero position:TTPositionFloatLeft next:nil];
}

- (TTStyle*)blueBox {
  return
    [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:6] next:
    [TTInsetStyle styleWithInset:UIEdgeInsetsMake(0, -5, -4, -6) next:
    [TTShadowStyle styleWithColor:[UIColor grayColor] blur:2 offset:CGSizeMake(1,1) next:
    [TTSolidFillStyle styleWithColor:[UIColor cyanColor] next:
    [TTSolidBorderStyle styleWithColor:[UIColor grayColor] width:1 next:nil]]]]];
}
TTStyledTextLabel
   NSString* kText = @"
 This is a test of styled labels.   Styled labels support

 <b>bold text</b>,

 <i>italic text</i>,

 <span class="blueText">colored text</span>,

 <span class="largeText">font sizes</span>,

 <span class="blueBox">spans with backgrounds</span>,

 inline images
 <img src="bundle://smiley.png"/>, and

 <a href="http://www.google.com">hyperlinks</a> you can
 actually touch. URLs are automatically converted into links, like this: http://www.foo.com

 <div>You can enclose blocks within an HTML div.</div>

 Both line break charactersnnand HTML line breaks<br/>are respected.";


TTStyledTextLabel* label1 = [[[TTStyledTextLabel alloc] initWithFrame:self.view.bounds] autorelease];
label1.font = [UIFont systemFontOfSize:17];
label1.text = [TTStyledText textFromXHTML:kText lineBreaks:YES URLs:YES];
label1.contentInset = UIEdgeInsetsMake(10, 10, 10, 10);
[label1 sizeToFit];
[self.view addSubview:label1];
TTView




// SpeechBubble
[TTShapeStyle styleWithShape:[TTSpeechBubbleShape shapeWithRadius:5 pointLocation:290
                                                  pointAngle:270
                                                  pointSize:CGSizeMake(20,10)] next:
[TTSolidFillStyle styleWithColor:[UIColor whiteColor] next:
[TTSolidBorderStyle styleWithColor:black width:1 next:nil]]]
TTView




// Badge
[TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:TT_ROUNDED] next:
[TTInsetStyle styleWithInset:UIEdgeInsetsMake(1.5, 1.5, 1.5, 1.5) next:
[TTShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.8) blur:3 offset:CGSizeMake(0, 5) next:
[TTReflectiveFillStyle styleWithColor:[UIColor redColor] next:
[TTInsetStyle styleWithInset:UIEdgeInsetsMake(-1.5, -1.5, -1.5, -1.5) next:
[TTSolidBorderStyle styleWithColor:[UIColor whiteColor] width:3 next:nil]]]]]]
TTView

// Mask
[TTMaskStyle styleWithMask:TTIMAGE(@"bundle://mask.png") next:
[TTLinearGradientFillStyle styleWithColor1:RGBCOLOR(0, 180, 231)
                           color2:RGBCOLOR(0, 0, 255) next:nil]]
TTButton
[TTButton   buttonWithStyle:@"toolbarButton:" title:@"Toolbar Button"]
[TTButton   buttonWithStyle:@"toolbarRoundButton:" title:@"Round Button"]
[TTButton   buttonWithStyle:@"toolbarBackButton:" title:@"Back Button"]
[TTButton   buttonWithStyle:@"toolbarForwardButton:" title:@"Forward Button"]
TTButton

- (TTStyle*)blackForwardButton:(UIControlState)state {
  TTShape* shape = [TTRoundedRightArrowShape shapeWithRadius:4.5];
  UIColor* tintColor = RGBCOLOR(0, 0, 0);
  return [TTSTYLESHEET toolbarButtonForState:state shape:shape tintColor:tintColor font:nil];
}

[TTButton buttonWithStyle:@"blackForwardButton:" title:@"Black Button"]
TTButton
- (TTStyle*)dropButton:(UIControlState)state {
  if (state == UIControlStateNormal) {
    return
      [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:8] next:
      [TTShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.7) blur:3 offset:CGSizeMake(2, 2) next:
      [TTTextStyle styleWithFont:nil color:TTSTYLEVAR(linkTextColor)
                   shadowColor:[UIColor colorWithWhite:255 alpha:0.4]
                   shadowOffset:CGSizeMake(0, -1) next:nil]]]]]]]]];
  } else if (state == UIControlStateHighlighted) {
    return
      [TTInsetStyle styleWithInset:UIEdgeInsetsMake(3, 3, 0, 0) next:
      [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:8] next:
      [TTTextStyle styleWithFont:nil color:TTSTYLEVAR(linkTextColor)
                   shadowColor:[UIColor colorWithWhite:255 alpha:0.4]
                   shadowOffset:CGSizeMake(0, -1) next:nil]]]]]]];
  }
}
[TTButton buttonWithStyle:@"dropButton:" title:@"Shadow Button"]
TTStyleBuilder
Widgets
Tabs
_tabBar1 = [[TTTabStrip alloc] initWithFrame:CGRectMake(0, 0, 320, 41)];
_tabBar1.tabItems = [NSArray arrayWithObjects:
  [[[TTTabItem alloc] initWithTitle:@"Item 1"] autorelease],
  [[[TTTabItem alloc] initWithTitle:@"Item 2"] autorelease],
  [[[TTTabItem alloc] initWithTitle:@"Item 3"] autorelease],
  [[[TTTabItem alloc] initWithTitle:@"Item 4"] autorelease],
  [[[TTTabItem alloc] initWithTitle:@"Item 5"] autorelease],
  nil];
[self.view addSubview:_tabBar1];
Tabs
_tabBar2 = [[TTTabBar alloc] initWithFrame:CGRectMake(0, _tabBar1.bottom, 320, 40)];
_tabBar2.tabItems = [NSArray arrayWithObjects:
  [[[TTTabItem alloc] initWithTitle:@"Banana"] autorelease],
  [[[TTTabItem alloc] initWithTitle:@"Cherry"] autorelease],
  [[[TTTabItem alloc] initWithTitle:@"Orange"] autorelease],
  [[[TTTabItem alloc] initWithTitle:@"Grape"] autorelease],
  nil];
_tabBar2.selectedTabIndex = 2;
[self.view addSubview:_tabBar2];

TTTabItem* item = [_tabBar2.tabItems objectAtIndex:1];
item.badgeNumber = 2;
Tabs
_tabBar3 = [[TTTabGrid alloc] initWithFrame:CGRectMake(10, _tabBar2.bottom+10, 300, 0)];
_tabBar3.backgroundColor = [UIColor clearColor];
_tabBar3.tabItems = [NSArray arrayWithObjects:
  [[[TTTabItem alloc] initWithTitle:@"Banana"] autorelease],
  [[[TTTabItem alloc] initWithTitle:@"Cherry"] autorelease],
  [[[TTTabItem alloc] initWithTitle:@"Orange"] autorelease],
  [[[TTTabItem alloc] initWithTitle:@"Pineapple"] autorelease],
  [[[TTTabItem alloc] initWithTitle:@"Grape"] autorelease],
  [[[TTTabItem alloc] initWithTitle:@"Mango"] autorelease],
  [[[TTTabItem alloc] initWithTitle:@"Blueberry"] autorelease],
  [[[TTTabItem alloc] initWithTitle:@"Apple"] autorelease],
  [[[TTTabItem alloc] initWithTitle:@"Peach"] autorelease],
  nil];
[_tabBar3 sizeToFit];
[self.view addSubview:_tabBar3];
Tabs
@protocol TTTabDelegate <NSObject>

- (void)tabBar:(TTTabBar*)tabBar tabSelected:
(NSInteger)selectedIndex;

@end
TTNavigator
TTNavigator


href do Three20

Automagicamente cria os ViewControllers e os
coloca no stack

Pode guardar todo o estado e depois restaura
1 - Registrar as URLs
TTNavigator* navigator = [TTNavigator navigator];
navigator.persistenceMode = TTNavigatorPersistenceModeAll;
navigator.window = [[[UIWindow alloc] initWithFrame:TTScreenBounds()] autorelease];

TTURLMap* map = navigator.URLMap;

// Any URL that doesn't match will fall back on this one, and open in the web browser
[map from:@"*" toViewController:[TTWebController class]];

// The tab bar controller is shared, meaning there will only ever be one created. Loading
// This URL will make the existing tab bar controller appear if it was not visible.
[map from:@"tt://tabBar" toSharedViewController:[TabBarController class]];

// Menu controllers are also shared - we only create one to show in each tab, so opening
// these URLs will switch to the tab containing the menu
[map from:@"tt://menu/(initWithMenu:)" toSharedViewController:[MenuController class]];

// A new food controllers will be created each time you open a food URL
[map from:@"tt://food/(initWithFood:)" toViewController:[ContentController class]];

// This is an example of how to use a transition. Opening the nutrition page will do a flip
[map from:@"tt://food/(initWithNutrition:)/nutrition" toViewController:[ContentController class]
     transition:UIViewAnimationTransitionFlipFromLeft];
1 - Registrar as URLs
// The ordering controller will appear as a modal view controller, animated from bottom to top
[map from:@"tt://order?waitress=(initWithWaitress:)"
     toModalViewController:[ContentController class]];

// This is a hash URL - it will simply invoke the method orderAction: on the order controller,
// and it will open the order controller first if it was not already visible
[map from:@"tt://order?waitress=()#(orderAction:)" toViewController:[ContentController class]];

// This will show the post controller to prompt to type in their order
[map from:@"tt://order/food" toViewController:[TTPostController class]];

// This will call the confirmOrder method on this app delegate and ask it to return a
// view controller to be opened. In this case, it will return an alert view controller.
// This kind of URL mapping gives you the chance to configure your controller before
// it is opened.
[map from:@"tt://order/confirm" toViewController:self selector:@selector(confirmOrder)];

// This will simply call the sendOrder method on this app delegate
[map from:@"tt://order/send" toObject:self selector:@selector(sendOrder)];
2 - Criar Links p/ as URLs

Todo componente tem uma propriedade
URL = @”tt://order/food”

Em qualquer método:
TTOpenURL(@”tt://food/banana”);

Em Styled Text:
<a href=”tt://food/banana/nutrition”>Bananas!</a>

Em TTTableItems:
[TTTableTextItem itemWithText:@”Banana” URL:@”tt://food/banana”]
Utilitários
TTURLRequest

Substitui NSURLRequest

Cache automático em disco!

POST usando apenas um dicionário

POST de arquivos!

Fila gerenciada pode ser suspensa a qualquer
momento.
TTURLRequest
TTURLRequest *req = [TTURLRequest requestWithURL:@”http://api.twitter.com/
post.xml” delegate:self];
NSMutableDictionary *parameters = req.parameters;
[parameters setObject:@”gpambrozio” forKey:@”username”];
[parameters setObject:@”senha” forKey:@”password”];

[req addFile:[NSData dataWithContentsOfFile:@”avatar.jpg”] mimeType:@”image/
jpg” fileName:@”avatar”];
// Pode ser assim tb!
[parameters setObject:[UIImage imageNamed:@”avatar.png”] forKey:@”avatar”];

req.httpMethod=@”POST”;
[req send];

Esperar no delegate por:

- (void)requestDidFinishLoad:(TTURLRequest*)request;

Parando todos os requests:
[TTURLRequestQueue mainQueue].suspended = YES;
Additions

NSString

NSDate

UIColor

UIImage

UIViewController

UIView

UITableView
Muito mais....
TTModel
Table Views e Table View Cells
Alguns View Controller já prontos:
   TTAlertViewController
   TTActionSheetController
   TTPostController
   TTPopupViewController
   TTWebController
   TTMessageController (pre 3.0)
Views prontos
   TTImageView
   TTYouTubeView
Ainda mais!!!


Text Fields:
  TTTextField
  TTSearchTextField
  TTPickerTextField
TTLauncherView
Cuidado!

Uso de APIs privadas

Arrumado em alguns forks
http://github.com/uprise78/three20-P31

Acompanhar na lista

Mas é open source....
Links


http://github.com/joehewitt/three20/

http://groups.google.com/group/three20

http://twitter.com/Three20

http://github.com/klazuka/TTStyleBuilder
Perguntas ???
Meus contatos



http://twitter.com/iphonebrazuca

gustavo@iphonebrazuca.com.br

Mais conteúdo relacionado

Semelhante a Three20 by Gustavo Ambrozio - 3º iphonedevbr

Spring 3 MVC CodeMash 2009
Spring 3 MVC   CodeMash 2009Spring 3 MVC   CodeMash 2009
Spring 3 MVC CodeMash 2009kensipe
 
Three20 framework for iOS development
Three20 framework for iOS developmentThree20 framework for iOS development
Three20 framework for iOS developmentRichard Lee
 
T3dallas typoscript
T3dallas typoscriptT3dallas typoscript
T3dallas typoscriptzdavis
 
The Magic of WPF & MVVM
The Magic of WPF & MVVMThe Magic of WPF & MVVM
The Magic of WPF & MVVMAbhishek Sur
 
ASP.NET MVC as the next step in web development
ASP.NET MVC as the next step in web developmentASP.NET MVC as the next step in web development
ASP.NET MVC as the next step in web developmentVolodymyr Voytyshyn
 
Objects arent records with byte codes on the side
Objects arent records with byte codes on the sideObjects arent records with byte codes on the side
Objects arent records with byte codes on the sideMichael Caruso
 
Adopting Swift Generics
Adopting Swift GenericsAdopting Swift Generics
Adopting Swift GenericsMax Sokolov
 
JWC - Rapid application development with FOF
JWC - Rapid application development with FOFJWC - Rapid application development with FOF
JWC - Rapid application development with FOFNicholas Dionysopoulos
 
SE2016 Android Dmytro Zaitsev "Viper make your MVP cleaner"
SE2016 Android Dmytro Zaitsev "Viper  make your MVP cleaner"SE2016 Android Dmytro Zaitsev "Viper  make your MVP cleaner"
SE2016 Android Dmytro Zaitsev "Viper make your MVP cleaner"Inhacking
 
Protocol Oriented MVVM - Auckland iOS Meetup
Protocol Oriented MVVM - Auckland iOS MeetupProtocol Oriented MVVM - Auckland iOS Meetup
Protocol Oriented MVVM - Auckland iOS MeetupNatasha Murashev
 
Js info vis_toolkit
Js info vis_toolkitJs info vis_toolkit
Js info vis_toolkitnikhilyagnic
 
ASP.NET MVC One Step Deeper
ASP.NET MVC One Step DeeperASP.NET MVC One Step Deeper
ASP.NET MVC One Step DeeperEmad Alashi
 
create-netflix-clone-03-server_transcript.pdf
create-netflix-clone-03-server_transcript.pdfcreate-netflix-clone-03-server_transcript.pdf
create-netflix-clone-03-server_transcript.pdfShaiAlmog1
 
Architectures for Inclusive Design
Architectures for Inclusive DesignArchitectures for Inclusive Design
Architectures for Inclusive Designcolinbdclark
 
Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)ukdpe
 
Introduction to XAML and its features
Introduction to XAML and its featuresIntroduction to XAML and its features
Introduction to XAML and its featuresAbhishek Sur
 
Sexy Architecting. VIPER: MVP on steroids
Sexy Architecting. VIPER: MVP on steroidsSexy Architecting. VIPER: MVP on steroids
Sexy Architecting. VIPER: MVP on steroidsDmytro Zaitsev
 

Semelhante a Three20 by Gustavo Ambrozio - 3º iphonedevbr (20)

Three20
Three20Three20
Three20
 
Spring 3 MVC CodeMash 2009
Spring 3 MVC   CodeMash 2009Spring 3 MVC   CodeMash 2009
Spring 3 MVC CodeMash 2009
 
Three20 framework for iOS development
Three20 framework for iOS developmentThree20 framework for iOS development
Three20 framework for iOS development
 
T3dallas typoscript
T3dallas typoscriptT3dallas typoscript
T3dallas typoscript
 
The Magic of WPF & MVVM
The Magic of WPF & MVVMThe Magic of WPF & MVVM
The Magic of WPF & MVVM
 
ASP.NET MVC as the next step in web development
ASP.NET MVC as the next step in web developmentASP.NET MVC as the next step in web development
ASP.NET MVC as the next step in web development
 
Objects arent records with byte codes on the side
Objects arent records with byte codes on the sideObjects arent records with byte codes on the side
Objects arent records with byte codes on the side
 
Adopting Swift Generics
Adopting Swift GenericsAdopting Swift Generics
Adopting Swift Generics
 
JWC - Rapid application development with FOF
JWC - Rapid application development with FOFJWC - Rapid application development with FOF
JWC - Rapid application development with FOF
 
MVC
MVCMVC
MVC
 
SE2016 Android Dmytro Zaitsev "Viper make your MVP cleaner"
SE2016 Android Dmytro Zaitsev "Viper  make your MVP cleaner"SE2016 Android Dmytro Zaitsev "Viper  make your MVP cleaner"
SE2016 Android Dmytro Zaitsev "Viper make your MVP cleaner"
 
Dmytro Zaitsev Viper: make your mvp cleaner
Dmytro Zaitsev Viper: make your mvp cleanerDmytro Zaitsev Viper: make your mvp cleaner
Dmytro Zaitsev Viper: make your mvp cleaner
 
Protocol Oriented MVVM - Auckland iOS Meetup
Protocol Oriented MVVM - Auckland iOS MeetupProtocol Oriented MVVM - Auckland iOS Meetup
Protocol Oriented MVVM - Auckland iOS Meetup
 
Js info vis_toolkit
Js info vis_toolkitJs info vis_toolkit
Js info vis_toolkit
 
ASP.NET MVC One Step Deeper
ASP.NET MVC One Step DeeperASP.NET MVC One Step Deeper
ASP.NET MVC One Step Deeper
 
create-netflix-clone-03-server_transcript.pdf
create-netflix-clone-03-server_transcript.pdfcreate-netflix-clone-03-server_transcript.pdf
create-netflix-clone-03-server_transcript.pdf
 
Architectures for Inclusive Design
Architectures for Inclusive DesignArchitectures for Inclusive Design
Architectures for Inclusive Design
 
Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)
 
Introduction to XAML and its features
Introduction to XAML and its featuresIntroduction to XAML and its features
Introduction to XAML and its features
 
Sexy Architecting. VIPER: MVP on steroids
Sexy Architecting. VIPER: MVP on steroidsSexy Architecting. VIPER: MVP on steroids
Sexy Architecting. VIPER: MVP on steroids
 

Último

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Último (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

Three20 by Gustavo Ambrozio - 3º iphonedevbr

  • 1. Three20 Como usar esta biblioteca e facilitar sua vida Gust av o Am broz io
  • 2. O que é o Three20 Biblioteca desenvolvida por Joe Hewitt (Facebook app) MVC para tabelas e listas Novos Widgets Rede e cache Estilo (Objective-CSS)
  • 4. Instalação Baixar do github (git clone git://github.com/uprise78/three20-P31.git) Nas prefs do Xcode, incluir a pasta de src do Three20 como um “Source Tree” Arrastar o Three20.xcodeproj para o root do seu projeto com o “Reference Type” relativo ao Source Tree que você criou e SEM copiar. Arrastar o libThree20.a para o link libraries do seu Target. Configurar o Three20 como dependência do seu Target. Aproveitar e incluir o QuartzCore framework ao Target. Inclusão do bundle to Three20 no projeto, também sem copiar e relativo ao Source Tree. Nas propriedades do projeto: Incluir o Source Tree do Three20 no “Header Search Paths” Incluir as flags “-ObjC” e “-all_load” no “Other Linker Flags” Incluir o “Three20/Three20.h” nos seus headers.
  • 5. Multifacetado! Photo Browser TTStyle Novos Widgets Navegação interna imitando web via Utilitários “URLs”
  • 7. Photo Browser Three20 Photo Browsing System class Data Interfaces protocol The arrows indicate either the message(s) that a class sends *or* how it uses another class. If a class implements a protocol, the protocol will be drawn inside the class's box. scrollView:didMoveToPageAtIndex: scollView:shouldZoom: many other optional methods thumbsViewController:didSelectPhoto: TTScrollView TTScrollView Delegate TTThumbs thumbsViewController:shouldNavigateToPhoto: ViewController TTScrollView Delegate TTThumbsViewController numberOfPagesInScrollView: scrollView:pageAtIndex: DataSource scrollView:sizeOfPageAtIndex: tableView:objectForRowAtIndexPath: many other optional methods load:nextPage: TTPhotoViewController list of "pages" TTTableView displayed horizontally DataSource TTThumbsDataSource TTPhotoSource TTPhotoSource TTThumbsTableView Delegate Delegate CellDelegate TTPhotoView TTPhotoView TTPhotoView thumbsTableViewCell:didSelectPhoto: TTThumbsTableViewCell photoAtIndex: photoAtIndex: each TTPhotoView asynchronously loadPhotosFromIndex:toIndex:cachePolicy: photoSourceDidStartLoad loadPhotosFromIndex:toIndex:cachePolicy: displays a single TTPhoto photoSourceDidFinishLoad: photoSource:didFailLoadWithError: photoSourceDidCancelLoad: TTPhoto TTPhotoSource list of photos Your TTPhoto Your TTPhotoSource Implementation Implementation
  • 8. Implementando Subclasse de TTPhotoSource - (BOOL)isLoading; - (BOOL)isLoaded; - (void)load:(TTURLRequestCachePolicy)cachePolicy more:(BOOL)more; - (void)cancel; - (NSInteger)numberOfPhotos; - (NSInteger)maxPhotoIndex; - (id<TTPhoto>)photoAtIndex:(NSInteger)index; [_delegates perform:@selector(modelDidFinishLoad:) withObject:self];
  • 9. TTPhoto Subclasse de TTPhoto - (NSString*)URLForVersion:(TTPhotoVersion)version { if (version == TTPhotoVersionLarge) { return _URL; } else if (version == TTPhotoVersionMedium) { return _URL; } else if (version == TTPhotoVersionSmall) { return _smallURL; } else if (version == TTPhotoVersionThumbnail) { return _thumbURL; } else { return nil; } }
  • 10. TTStyle Inspirado no CSS do HTML Catálogo do Look and Feel do seu app que pode mudar todo o look a qualquer tempo Sempre derivará do TTDefaultStyleSheet [TTStyleSheet setGlobalStyleSheet:[[[MyStyleSheet alloc] init] autorelease]]; Repositórios de elementos globais como cores e fontes Estilos complexos
  • 11. Globais @interface MyStyleSheet : TTDefaultStyleSheet @property(nonatomic,readonly) UIColor* myFirstColor; @property(nonatomic,readonly) UIFont* myFirstFont; @end @implementation MyStyleSheet - (UIColor*)myFirstColor { return RGBCOLOR(80, 110, 140); UILabel* label; } label.font = TTSTYLEVAR(myFirstFont); label.textColor = TTSTYLEVAR(myFirstColor); - (UIColor*)mySecondColor { return [UIColor grayColor]; } - (UIFont*)myFirstFont { return [UIFont boldSystemFontOfSize:15]; } - (UIFont*)mySecondFont { return [UIFont systemFontOfSize:14]; } @end http://mattvague.com/three20-stylesheets-tutorial
  • 12. Estilos complexos É uma cadeia de TTStyle. Cada TTStyle é uma “caixa preta” que pode desenhar ou simplesmente alterar o contexto. O Sample TTCatalog é o mais completo guia de estilos. TTStyle.h TTStyleBuilder (http://github.com/klazuka/TTStyleBuilder)
  • 13. A cadeia - (void)draw:(TTStyleContext*)context { // Modifica o context // Desenha algo usando o context // Chama o next! [self.next draw:context]; }
  • 14. TTStyledTextLabel - (TTStyle*)smallText { return [TTTextStyle styleWithFont:[UIFont systemFontOfSize:12] next:nil]; } - (TTStyle*)floated { return [TTBoxStyle styleWithMargin:UIEdgeInsetsMake(0, 0, 5, 5) padding:UIEdgeInsetsMake(0, 0, 0, 0) minSize:CGSizeZero position:TTPositionFloatLeft next:nil]; } - (TTStyle*)blueBox { return [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:6] next: [TTInsetStyle styleWithInset:UIEdgeInsetsMake(0, -5, -4, -6) next: [TTShadowStyle styleWithColor:[UIColor grayColor] blur:2 offset:CGSizeMake(1,1) next: [TTSolidFillStyle styleWithColor:[UIColor cyanColor] next: [TTSolidBorderStyle styleWithColor:[UIColor grayColor] width:1 next:nil]]]]]; }
  • 15. TTStyledTextLabel NSString* kText = @" This is a test of styled labels. Styled labels support <b>bold text</b>, <i>italic text</i>, <span class="blueText">colored text</span>, <span class="largeText">font sizes</span>, <span class="blueBox">spans with backgrounds</span>, inline images <img src="bundle://smiley.png"/>, and <a href="http://www.google.com">hyperlinks</a> you can actually touch. URLs are automatically converted into links, like this: http://www.foo.com <div>You can enclose blocks within an HTML div.</div> Both line break charactersnnand HTML line breaks<br/>are respected."; TTStyledTextLabel* label1 = [[[TTStyledTextLabel alloc] initWithFrame:self.view.bounds] autorelease]; label1.font = [UIFont systemFontOfSize:17]; label1.text = [TTStyledText textFromXHTML:kText lineBreaks:YES URLs:YES]; label1.contentInset = UIEdgeInsetsMake(10, 10, 10, 10); [label1 sizeToFit]; [self.view addSubview:label1];
  • 16. TTView // SpeechBubble [TTShapeStyle styleWithShape:[TTSpeechBubbleShape shapeWithRadius:5 pointLocation:290 pointAngle:270 pointSize:CGSizeMake(20,10)] next: [TTSolidFillStyle styleWithColor:[UIColor whiteColor] next: [TTSolidBorderStyle styleWithColor:black width:1 next:nil]]]
  • 17. TTView // Badge [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:TT_ROUNDED] next: [TTInsetStyle styleWithInset:UIEdgeInsetsMake(1.5, 1.5, 1.5, 1.5) next: [TTShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.8) blur:3 offset:CGSizeMake(0, 5) next: [TTReflectiveFillStyle styleWithColor:[UIColor redColor] next: [TTInsetStyle styleWithInset:UIEdgeInsetsMake(-1.5, -1.5, -1.5, -1.5) next: [TTSolidBorderStyle styleWithColor:[UIColor whiteColor] width:3 next:nil]]]]]]
  • 18. TTView // Mask [TTMaskStyle styleWithMask:TTIMAGE(@"bundle://mask.png") next: [TTLinearGradientFillStyle styleWithColor1:RGBCOLOR(0, 180, 231) color2:RGBCOLOR(0, 0, 255) next:nil]]
  • 19. TTButton [TTButton buttonWithStyle:@"toolbarButton:" title:@"Toolbar Button"] [TTButton buttonWithStyle:@"toolbarRoundButton:" title:@"Round Button"] [TTButton buttonWithStyle:@"toolbarBackButton:" title:@"Back Button"] [TTButton buttonWithStyle:@"toolbarForwardButton:" title:@"Forward Button"]
  • 20. TTButton - (TTStyle*)blackForwardButton:(UIControlState)state { TTShape* shape = [TTRoundedRightArrowShape shapeWithRadius:4.5]; UIColor* tintColor = RGBCOLOR(0, 0, 0); return [TTSTYLESHEET toolbarButtonForState:state shape:shape tintColor:tintColor font:nil]; } [TTButton buttonWithStyle:@"blackForwardButton:" title:@"Black Button"]
  • 21. TTButton - (TTStyle*)dropButton:(UIControlState)state { if (state == UIControlStateNormal) { return [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:8] next: [TTShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.7) blur:3 offset:CGSizeMake(2, 2) next: [TTTextStyle styleWithFont:nil color:TTSTYLEVAR(linkTextColor) shadowColor:[UIColor colorWithWhite:255 alpha:0.4] shadowOffset:CGSizeMake(0, -1) next:nil]]]]]]]]]; } else if (state == UIControlStateHighlighted) { return [TTInsetStyle styleWithInset:UIEdgeInsetsMake(3, 3, 0, 0) next: [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:8] next: [TTTextStyle styleWithFont:nil color:TTSTYLEVAR(linkTextColor) shadowColor:[UIColor colorWithWhite:255 alpha:0.4] shadowOffset:CGSizeMake(0, -1) next:nil]]]]]]]; } } [TTButton buttonWithStyle:@"dropButton:" title:@"Shadow Button"]
  • 24. Tabs _tabBar1 = [[TTTabStrip alloc] initWithFrame:CGRectMake(0, 0, 320, 41)]; _tabBar1.tabItems = [NSArray arrayWithObjects: [[[TTTabItem alloc] initWithTitle:@"Item 1"] autorelease], [[[TTTabItem alloc] initWithTitle:@"Item 2"] autorelease], [[[TTTabItem alloc] initWithTitle:@"Item 3"] autorelease], [[[TTTabItem alloc] initWithTitle:@"Item 4"] autorelease], [[[TTTabItem alloc] initWithTitle:@"Item 5"] autorelease], nil]; [self.view addSubview:_tabBar1];
  • 25. Tabs _tabBar2 = [[TTTabBar alloc] initWithFrame:CGRectMake(0, _tabBar1.bottom, 320, 40)]; _tabBar2.tabItems = [NSArray arrayWithObjects: [[[TTTabItem alloc] initWithTitle:@"Banana"] autorelease], [[[TTTabItem alloc] initWithTitle:@"Cherry"] autorelease], [[[TTTabItem alloc] initWithTitle:@"Orange"] autorelease], [[[TTTabItem alloc] initWithTitle:@"Grape"] autorelease], nil]; _tabBar2.selectedTabIndex = 2; [self.view addSubview:_tabBar2]; TTTabItem* item = [_tabBar2.tabItems objectAtIndex:1]; item.badgeNumber = 2;
  • 26. Tabs _tabBar3 = [[TTTabGrid alloc] initWithFrame:CGRectMake(10, _tabBar2.bottom+10, 300, 0)]; _tabBar3.backgroundColor = [UIColor clearColor]; _tabBar3.tabItems = [NSArray arrayWithObjects: [[[TTTabItem alloc] initWithTitle:@"Banana"] autorelease], [[[TTTabItem alloc] initWithTitle:@"Cherry"] autorelease], [[[TTTabItem alloc] initWithTitle:@"Orange"] autorelease], [[[TTTabItem alloc] initWithTitle:@"Pineapple"] autorelease], [[[TTTabItem alloc] initWithTitle:@"Grape"] autorelease], [[[TTTabItem alloc] initWithTitle:@"Mango"] autorelease], [[[TTTabItem alloc] initWithTitle:@"Blueberry"] autorelease], [[[TTTabItem alloc] initWithTitle:@"Apple"] autorelease], [[[TTTabItem alloc] initWithTitle:@"Peach"] autorelease], nil]; [_tabBar3 sizeToFit]; [self.view addSubview:_tabBar3];
  • 27. Tabs @protocol TTTabDelegate <NSObject> - (void)tabBar:(TTTabBar*)tabBar tabSelected: (NSInteger)selectedIndex; @end
  • 29. TTNavigator href do Three20 Automagicamente cria os ViewControllers e os coloca no stack Pode guardar todo o estado e depois restaura
  • 30. 1 - Registrar as URLs TTNavigator* navigator = [TTNavigator navigator]; navigator.persistenceMode = TTNavigatorPersistenceModeAll; navigator.window = [[[UIWindow alloc] initWithFrame:TTScreenBounds()] autorelease]; TTURLMap* map = navigator.URLMap; // Any URL that doesn't match will fall back on this one, and open in the web browser [map from:@"*" toViewController:[TTWebController class]]; // The tab bar controller is shared, meaning there will only ever be one created. Loading // This URL will make the existing tab bar controller appear if it was not visible. [map from:@"tt://tabBar" toSharedViewController:[TabBarController class]]; // Menu controllers are also shared - we only create one to show in each tab, so opening // these URLs will switch to the tab containing the menu [map from:@"tt://menu/(initWithMenu:)" toSharedViewController:[MenuController class]]; // A new food controllers will be created each time you open a food URL [map from:@"tt://food/(initWithFood:)" toViewController:[ContentController class]]; // This is an example of how to use a transition. Opening the nutrition page will do a flip [map from:@"tt://food/(initWithNutrition:)/nutrition" toViewController:[ContentController class] transition:UIViewAnimationTransitionFlipFromLeft];
  • 31. 1 - Registrar as URLs // The ordering controller will appear as a modal view controller, animated from bottom to top [map from:@"tt://order?waitress=(initWithWaitress:)" toModalViewController:[ContentController class]]; // This is a hash URL - it will simply invoke the method orderAction: on the order controller, // and it will open the order controller first if it was not already visible [map from:@"tt://order?waitress=()#(orderAction:)" toViewController:[ContentController class]]; // This will show the post controller to prompt to type in their order [map from:@"tt://order/food" toViewController:[TTPostController class]]; // This will call the confirmOrder method on this app delegate and ask it to return a // view controller to be opened. In this case, it will return an alert view controller. // This kind of URL mapping gives you the chance to configure your controller before // it is opened. [map from:@"tt://order/confirm" toViewController:self selector:@selector(confirmOrder)]; // This will simply call the sendOrder method on this app delegate [map from:@"tt://order/send" toObject:self selector:@selector(sendOrder)];
  • 32. 2 - Criar Links p/ as URLs Todo componente tem uma propriedade URL = @”tt://order/food” Em qualquer método: TTOpenURL(@”tt://food/banana”); Em Styled Text: <a href=”tt://food/banana/nutrition”>Bananas!</a> Em TTTableItems: [TTTableTextItem itemWithText:@”Banana” URL:@”tt://food/banana”]
  • 34. TTURLRequest Substitui NSURLRequest Cache automático em disco! POST usando apenas um dicionário POST de arquivos! Fila gerenciada pode ser suspensa a qualquer momento.
  • 35. TTURLRequest TTURLRequest *req = [TTURLRequest requestWithURL:@”http://api.twitter.com/ post.xml” delegate:self]; NSMutableDictionary *parameters = req.parameters; [parameters setObject:@”gpambrozio” forKey:@”username”]; [parameters setObject:@”senha” forKey:@”password”]; [req addFile:[NSData dataWithContentsOfFile:@”avatar.jpg”] mimeType:@”image/ jpg” fileName:@”avatar”]; // Pode ser assim tb! [parameters setObject:[UIImage imageNamed:@”avatar.png”] forKey:@”avatar”]; req.httpMethod=@”POST”; [req send]; Esperar no delegate por: - (void)requestDidFinishLoad:(TTURLRequest*)request; Parando todos os requests: [TTURLRequestQueue mainQueue].suspended = YES;
  • 37. Muito mais.... TTModel Table Views e Table View Cells Alguns View Controller já prontos: TTAlertViewController TTActionSheetController TTPostController TTPopupViewController TTWebController TTMessageController (pre 3.0) Views prontos TTImageView TTYouTubeView
  • 38. Ainda mais!!! Text Fields: TTTextField TTSearchTextField TTPickerTextField TTLauncherView
  • 39. Cuidado! Uso de APIs privadas Arrumado em alguns forks http://github.com/uprise78/three20-P31 Acompanhar na lista Mas é open source....