Three20 is a popular open source framework for iOS development originally created by Facebook to build their mobile app; it includes modules for core utilities, networking, UI components, and navigation that make iOS apps feel more like web apps; Some key components are TTImageView for asynchronous image loading, TTPhotoViewController, and UINavigator for navigation with URL mapping.
6. Mobile first, web second.
1. Mobile is exploding
2. Mobile forces you to focus
3. Mobile extends your capabilities
Luke Wroblewski
Source : http://www.lukew.com/ff/entry.asp?933
7. Connected to Internet
90% apps has data transmission to server
•Push notifications
•Member system
•Data display/browse
•Online ranking
•Search
8. Cocoa touch aren’t optimized as a web client
•No simple mechanism to manipulate online objects
•Need to make lots of caches of online resource
•Some UI components are missing
•Navigation between view controllers are trivial
•There’re event no built-in JSON parsers!
10. Three20
•Originally developed by Joe Hewitt at Facebook
•Used to build official Facebook app
•Similar to many web frameworks
•Now an most popular Objective-C project on GitHub
13. Three20 Core
Three20 Core provides a basic set of tools useful for
debugging your applications, dealing with standard data
structures, and doing basic text manipulation.
Examples:
•TT_RELEASE_SAFELY(POINTER);
•NSString* TTPathForDocumentsResource(NSString* relativePath);
•(NSDictionary*)queryDictionaryUsingEncoding:(NSStringEncoding)
encoding;
•NSArray - (void)perform:(SEL)selector;
•NSData - (NSString*)md5Hash;
14. Three20 Network
Three20 Network mainly provide TTURLRequest,
compared to NSURLRequest, it provides more features.
Features
•HTTP methods support (POST/GET/PUT)
•Simple post parameters
•File-based cache
•Automatically parse downloaded data an validate
•Handle cookies
15. Three20 UICommon
Three20 UICommon provides basic UI utilities for
construction of higher level UI modules.
Examples:
•float TTOSVersion();
•BOOL TTIsPad();
•BOOL TTIsKeyboardVisible();
•void TTAlert(NSString* message);
•- (UIView*)findFirstResponderInView:(UIView*)topView;
16. Three20 UINavigator
Three20 UINavigator makes iPhone apps like web apps
based on URL-mapping mechanism.
The URLs are mapped into Objective-C view controllers,
and the parameters are passed to init method.
Features:
•TTBaseNavigator - The main url handler to open urls
•TTURLAction - Action to open url with some option parameters
•TTURLMap - Map URLS to view controllers
18. Three20 Style
Three20 Style make developers to style UIs with a main
stylesheets, instead of manually set each UIs style.
Also it provides some utilities to cope with UIs and do
images manipulations.
Examples:
•- (UIImage*)transformWidth:(CGFloat)width height:(CGFloat)height rotate:
(BOOL)rotate;
•- (void)drawInRect:(CGRect)rect radius:(CGFloat)radius;
19. Three20 UI
Three20 UI is the most wonderful part of the framework,
includes enhancements of UIKit, new view controllers and
new UI components
20. TTImageView examples
TTImageView *imageView = [[TTImageView alloc] initWithFrame:frame];
[imageView setUrlPath:@"http://www.foo.com/bar.jpg"];
Instead of
UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame];
NSURL *url = [NSURL URLWithString:@"http://www.foo.com/bar.jpg"];
NSData *data = [[NSData alloc] initWithContentsOfURL:url];
[imageView setImage:[UIImage imageWithData:data]];
and with additional
asynchronous loading, and disk cache
25. Three20 Extensions
extCSSStyle
This extension provides support for reading Three20 style sheets from CSS files.
extXML
Three20 XML Extension for parsing XML objects into Objective-C NSObjects.
extJSON
Three20 JSON Extension for parsing JSON objects in to Objective-C
NSObjects.